ntermqt 0.1.7__tar.gz → 0.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {ntermqt-0.1.7/ntermqt.egg-info → ntermqt-0.1.8}/PKG-INFO +88 -28
  2. {ntermqt-0.1.7 → ntermqt-0.1.8}/README.md +87 -27
  3. ntermqt-0.1.8/nterm/parser/api_help_dialog.py +810 -0
  4. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/scripting/api.py +247 -691
  5. ntermqt-0.1.8/nterm/scripting/models.py +195 -0
  6. ntermqt-0.1.8/nterm/scripting/platform_data.py +272 -0
  7. ntermqt-0.1.8/nterm/scripting/platform_utils.py +330 -0
  8. ntermqt-0.1.8/nterm/scripting/repl.py +647 -0
  9. ntermqt-0.1.8/nterm/scripting/repl_interactive.py +536 -0
  10. ntermqt-0.1.8/nterm/scripting/ssh_connection.py +632 -0
  11. ntermqt-0.1.8/nterm/scripting/test_api_repl.py +290 -0
  12. {ntermqt-0.1.7 → ntermqt-0.1.8/ntermqt.egg-info}/PKG-INFO +88 -28
  13. {ntermqt-0.1.7 → ntermqt-0.1.8}/ntermqt.egg-info/SOURCES.txt +5 -0
  14. {ntermqt-0.1.7 → ntermqt-0.1.8}/pyproject.toml +1 -1
  15. ntermqt-0.1.7/nterm/parser/api_help_dialog.py +0 -607
  16. ntermqt-0.1.7/nterm/scripting/repl.py +0 -410
  17. ntermqt-0.1.7/nterm/scripting/repl_interactive.py +0 -418
  18. {ntermqt-0.1.7 → ntermqt-0.1.8}/MANIFEST.in +0 -0
  19. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/__init__.py +0 -0
  20. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/__main__.py +0 -0
  21. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/askpass/__init__.py +0 -0
  22. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/askpass/server.py +0 -0
  23. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/config.py +0 -0
  24. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/connection/__init__.py +0 -0
  25. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/connection/profile.py +0 -0
  26. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/manager/__init__.py +0 -0
  27. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/manager/connect_dialog.py +0 -0
  28. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/manager/editor.py +0 -0
  29. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/manager/io.py +0 -0
  30. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/manager/models.py +0 -0
  31. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/manager/settings.py +0 -0
  32. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/manager/tree.py +0 -0
  33. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/parser/__init__.py +0 -0
  34. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/parser/ntc_download_dialog.py +0 -0
  35. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/parser/tfsm_engine.py +0 -0
  36. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/parser/tfsm_fire.py +0 -0
  37. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/parser/tfsm_fire_tester.py +0 -0
  38. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/resources.py +0 -0
  39. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/scripting/__init__.py +0 -0
  40. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/scripting/cli.py +0 -0
  41. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/session/__init__.py +0 -0
  42. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/session/askpass_ssh.py +0 -0
  43. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/session/base.py +0 -0
  44. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/session/interactive_ssh.py +0 -0
  45. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/session/local_terminal.py +0 -0
  46. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/session/pty_transport.py +0 -0
  47. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/session/ssh.py +0 -0
  48. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/__init__.py +0 -0
  49. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/bridge.py +0 -0
  50. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/resources/terminal.html +0 -0
  51. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/resources/terminal.js +0 -0
  52. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/resources/xterm-addon-fit.min.js +0 -0
  53. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/resources/xterm-addon-unicode11.min.js +0 -0
  54. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/resources/xterm-addon-web-links.min.js +0 -0
  55. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/resources/xterm.css +0 -0
  56. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/resources/xterm.min.js +0 -0
  57. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/terminal/widget.py +0 -0
  58. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/__init__.py +0 -0
  59. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/engine.py +0 -0
  60. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/stylesheet.py +0 -0
  61. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/clean.yaml +0 -0
  62. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/default.yaml +0 -0
  63. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/dracula.yaml +0 -0
  64. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/enterprise_dark.yaml +0 -0
  65. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/enterprise_hybrid.yaml +0 -0
  66. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/enterprise_light.yaml +0 -0
  67. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/gruvbox_dark.yaml +0 -0
  68. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/gruvbox_hybrid.yaml +0 -0
  69. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/gruvbox_light.yaml +0 -0
  70. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/theme/themes/nord_hybrid.yaml +0 -0
  71. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/vault/__init__.py +0 -0
  72. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/vault/credential_manager.py +0 -0
  73. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/vault/keychain.py +0 -0
  74. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/vault/manager_ui.py +0 -0
  75. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/vault/profile.py +0 -0
  76. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/vault/resolver.py +0 -0
  77. {ntermqt-0.1.7 → ntermqt-0.1.8}/nterm/vault/store.py +0 -0
  78. {ntermqt-0.1.7 → ntermqt-0.1.8}/ntermqt.egg-info/dependency_links.txt +0 -0
  79. {ntermqt-0.1.7 → ntermqt-0.1.8}/ntermqt.egg-info/entry_points.txt +0 -0
  80. {ntermqt-0.1.7 → ntermqt-0.1.8}/ntermqt.egg-info/requires.txt +0 -0
  81. {ntermqt-0.1.7 → ntermqt-0.1.8}/ntermqt.egg-info/top_level.txt +0 -0
  82. {ntermqt-0.1.7 → ntermqt-0.1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ntermqt
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Modern SSH terminal widget for PyQt6 with credential vault and jump host support
5
5
  Author: Scott Peterman
6
6
  License: GPL-3.0
@@ -85,10 +85,11 @@ Built for managing hundreds of devices through bastion hosts with hardware secur
85
85
  - Cross-platform keychain: macOS Keychain, Windows Credential Locker, Linux Secret Service
86
86
  - Full PyQt6 management UI
87
87
 
88
- **Scripting API** *(Experimental)*
88
+ **Scripting API**
89
89
  - Query device inventory and credentials programmatically
90
90
  - Built-in IPython console with API pre-loaded
91
- - CLI for shell scripts and automation
91
+ - **Platform-aware commands** - one API, correct syntax everywhere
92
+ - **Interactive REPL** with quick commands and structured output
92
93
  - Foundation for MCP tools and agentic workflows
93
94
 
94
95
  ---
@@ -192,9 +193,9 @@ python -m nterm
192
193
 
193
194
  ---
194
195
 
195
- ## Scripting API *(Experimental)*
196
+ ## Scripting API
196
197
 
197
- nterm includes a scripting API for programmatic access to your device inventory and credential vault. Use it from IPython, CLI, or Python scripts.
198
+ nterm includes a full scripting API for programmatic access to your device inventory, credential vault, and network devices. Use it from IPython, CLI, or Python scripts.
198
199
 
199
200
  ### IPython Console
200
201
 
@@ -204,49 +205,103 @@ Open **Dev → IPython → Open in Tab** to get an interactive console with the
204
205
  api.devices() # List all saved devices
205
206
  api.search("leaf") # Search by name/hostname
206
207
  api.devices("eng-*") # Glob pattern filter
208
+ api.folders() # List all folders
207
209
 
208
210
  api.unlock("vault-password") # Unlock credential vault
209
211
  api.credentials() # List credentials (metadata only)
210
212
 
213
+ # Connect and execute commands
214
+ with api.session("usa-leaf-1") as s:
215
+ result = api.send(s, "show version")
216
+ print(result.parsed_data)
217
+
211
218
  api.help() # Show all commands
212
219
  ```
213
220
 
214
- ### CLI
221
+ ### Interactive REPL
215
222
 
216
- ```bash
217
- nterm-cli devices # List all devices
218
- nterm-cli search leaf # Search devices
219
- nterm-cli device eng-leaf-1 # Device details
220
- nterm-cli credentials --unlock # List credentials
221
- nterm-cli --json devices # JSON output for scripting
223
+ Start the REPL for interactive device exploration with platform-aware quick commands:
224
+
225
+ ```python
226
+ api.repl()
227
+ ```
228
+
229
+ ```
230
+ nterm> :unlock
231
+ nterm> :connect usa-leaf-1
232
+
233
+ 📊 usa-leaf-1> :version
234
+ ──────────────────────────────────────────────────
235
+ Version: 15.2(4.0.55)E
236
+ Hardware: IOSv
237
+ Serial: 9J0PD0QB9W1
238
+ Uptime: 1 week, 4 days, 7 minutes
239
+ ──────────────────────────────────────────────────
240
+
241
+ 📊 usa-leaf-1> :neighbors
242
+ Local Interface Neighbor Remote Port
243
+ ----------------------------------------------------------------
244
+ Gi0/0 usa-spine-2.lab.local Ethernet1
245
+ Gi0/1 usa-spine-1.lab.local Ethernet1
246
+
247
+ 📊 usa-leaf-1> :interfaces
248
+ [Rich formatted interface table]
222
249
  ```
223
250
 
251
+ **Quick Commands:**
252
+ - `:version` - Structured version info
253
+ - `:config` - Running configuration
254
+ - `:interfaces` - Interface status
255
+ - `:neighbors` - CDP/LLDP neighbors (auto-detects)
256
+ - `:bgp` - BGP summary
257
+ - `:routes` - Routing table
258
+
224
259
  ### Python Scripts
225
260
 
226
261
  ```python
227
262
  from nterm.scripting import NTermAPI
228
263
 
229
264
  api = NTermAPI()
265
+ api.unlock("vault-password")
230
266
 
231
- # Query devices
267
+ # Context manager for automatic cleanup
232
268
  for device in api.devices("*spine*"):
233
- print(f"{device.name}: {device.hostname}")
234
-
235
- # Work with credentials
236
- api.unlock("vault-password")
237
- cred = api.credential("lab-admin")
238
- print(f"Username: {cred.username}")
269
+ with api.session(device.name) as s:
270
+ # Platform-aware commands - works on Cisco, Arista, Juniper
271
+ result = api.send_platform_command(s, 'version')
272
+ print(f"{device.name}: {result.parsed_data[0].get('VERSION')}")
273
+
274
+ # Try multiple commands until one works
275
+ with api.session("router1") as s:
276
+ result = api.send_first(s, [
277
+ "show cdp neighbors detail",
278
+ "show lldp neighbors detail",
279
+ ])
239
280
  ```
240
281
 
241
- ### Roadmap
282
+ ### CLI
283
+
284
+ ```bash
285
+ nterm-cli devices # List all devices
286
+ nterm-cli search leaf # Search devices
287
+ nterm-cli device eng-leaf-1 # Device details
288
+ nterm-cli credentials --unlock # List credentials
289
+ nterm-cli --json devices # JSON output for scripting
290
+ ```
242
291
 
243
- The scripting API is the foundation for:
292
+ ### Key Features
244
293
 
245
- - **Command execution** `api.connect()` and `api.send()` for programmatic device interaction
246
- - **Batch operations** — Fan out commands across device groups
247
- - **MCP tool integration** Expose nterm capabilities to AI agents
294
+ | Feature | Description |
295
+ |---------|-------------|
296
+ | **Context Manager** | `with api.session()` auto-disconnects |
297
+ | **Platform-Aware** | `send_platform_command()` picks correct syntax |
298
+ | **Fallback Commands** | `send_first()` tries alternatives |
299
+ | **Structured Output** | TextFSM parsing to List[Dict] |
300
+ | **ANSI Filtering** | Clean output, no escape sequences |
301
+ | **Paging Detection** | Raises error if paging not disabled |
248
302
 
249
- See [scripting/README.md](nterm/scripting/README.md) for full API documentation.
303
+ See [scripting/README_API_IPython.md](nterm/scripting/README_API_IPython.md) for full API documentation.
304
+ See [scripting/README_REPL.md](nterm/scripting/README_REPL.md) for REPL documentation.
250
305
 
251
306
  ---
252
307
 
@@ -436,9 +491,14 @@ nterm/
436
491
  │ ├── resolver.py # Pattern-based resolution
437
492
  │ └── manager_ui.py # PyQt6 credential manager
438
493
  ├── manager/ # Session tree, connection dialogs
439
- └── scripting/ # API, CLI, automation support
440
- ├── api.py # NTermAPI class
441
- └── cli.py # nterm-cli entry point
494
+ └── scripting/ # API, REPL, automation support
495
+ ├── api.py # NTermAPI class
496
+ ├── models.py # ActiveSession, CommandResult, DeviceInfo
497
+ ├── platform_data.py # Platform commands and patterns
498
+ ├── platform_utils.py # Platform detection, extraction helpers
499
+ ├── ssh_connection.py # Low-level SSH with ANSI filtering
500
+ ├── repl.py # NTermREPL command router
501
+ └── repl_interactive.py # Interactive REPL display
442
502
  ```
443
503
 
444
504
  ---
@@ -40,10 +40,11 @@ Built for managing hundreds of devices through bastion hosts with hardware secur
40
40
  - Cross-platform keychain: macOS Keychain, Windows Credential Locker, Linux Secret Service
41
41
  - Full PyQt6 management UI
42
42
 
43
- **Scripting API** *(Experimental)*
43
+ **Scripting API**
44
44
  - Query device inventory and credentials programmatically
45
45
  - Built-in IPython console with API pre-loaded
46
- - CLI for shell scripts and automation
46
+ - **Platform-aware commands** - one API, correct syntax everywhere
47
+ - **Interactive REPL** with quick commands and structured output
47
48
  - Foundation for MCP tools and agentic workflows
48
49
 
49
50
  ---
@@ -147,9 +148,9 @@ python -m nterm
147
148
 
148
149
  ---
149
150
 
150
- ## Scripting API *(Experimental)*
151
+ ## Scripting API
151
152
 
152
- nterm includes a scripting API for programmatic access to your device inventory and credential vault. Use it from IPython, CLI, or Python scripts.
153
+ nterm includes a full scripting API for programmatic access to your device inventory, credential vault, and network devices. Use it from IPython, CLI, or Python scripts.
153
154
 
154
155
  ### IPython Console
155
156
 
@@ -159,49 +160,103 @@ Open **Dev → IPython → Open in Tab** to get an interactive console with the
159
160
  api.devices() # List all saved devices
160
161
  api.search("leaf") # Search by name/hostname
161
162
  api.devices("eng-*") # Glob pattern filter
163
+ api.folders() # List all folders
162
164
 
163
165
  api.unlock("vault-password") # Unlock credential vault
164
166
  api.credentials() # List credentials (metadata only)
165
167
 
168
+ # Connect and execute commands
169
+ with api.session("usa-leaf-1") as s:
170
+ result = api.send(s, "show version")
171
+ print(result.parsed_data)
172
+
166
173
  api.help() # Show all commands
167
174
  ```
168
175
 
169
- ### CLI
176
+ ### Interactive REPL
170
177
 
171
- ```bash
172
- nterm-cli devices # List all devices
173
- nterm-cli search leaf # Search devices
174
- nterm-cli device eng-leaf-1 # Device details
175
- nterm-cli credentials --unlock # List credentials
176
- nterm-cli --json devices # JSON output for scripting
178
+ Start the REPL for interactive device exploration with platform-aware quick commands:
179
+
180
+ ```python
181
+ api.repl()
182
+ ```
183
+
184
+ ```
185
+ nterm> :unlock
186
+ nterm> :connect usa-leaf-1
187
+
188
+ 📊 usa-leaf-1> :version
189
+ ──────────────────────────────────────────────────
190
+ Version: 15.2(4.0.55)E
191
+ Hardware: IOSv
192
+ Serial: 9J0PD0QB9W1
193
+ Uptime: 1 week, 4 days, 7 minutes
194
+ ──────────────────────────────────────────────────
195
+
196
+ 📊 usa-leaf-1> :neighbors
197
+ Local Interface Neighbor Remote Port
198
+ ----------------------------------------------------------------
199
+ Gi0/0 usa-spine-2.lab.local Ethernet1
200
+ Gi0/1 usa-spine-1.lab.local Ethernet1
201
+
202
+ 📊 usa-leaf-1> :interfaces
203
+ [Rich formatted interface table]
177
204
  ```
178
205
 
206
+ **Quick Commands:**
207
+ - `:version` - Structured version info
208
+ - `:config` - Running configuration
209
+ - `:interfaces` - Interface status
210
+ - `:neighbors` - CDP/LLDP neighbors (auto-detects)
211
+ - `:bgp` - BGP summary
212
+ - `:routes` - Routing table
213
+
179
214
  ### Python Scripts
180
215
 
181
216
  ```python
182
217
  from nterm.scripting import NTermAPI
183
218
 
184
219
  api = NTermAPI()
220
+ api.unlock("vault-password")
185
221
 
186
- # Query devices
222
+ # Context manager for automatic cleanup
187
223
  for device in api.devices("*spine*"):
188
- print(f"{device.name}: {device.hostname}")
189
-
190
- # Work with credentials
191
- api.unlock("vault-password")
192
- cred = api.credential("lab-admin")
193
- print(f"Username: {cred.username}")
224
+ with api.session(device.name) as s:
225
+ # Platform-aware commands - works on Cisco, Arista, Juniper
226
+ result = api.send_platform_command(s, 'version')
227
+ print(f"{device.name}: {result.parsed_data[0].get('VERSION')}")
228
+
229
+ # Try multiple commands until one works
230
+ with api.session("router1") as s:
231
+ result = api.send_first(s, [
232
+ "show cdp neighbors detail",
233
+ "show lldp neighbors detail",
234
+ ])
194
235
  ```
195
236
 
196
- ### Roadmap
237
+ ### CLI
238
+
239
+ ```bash
240
+ nterm-cli devices # List all devices
241
+ nterm-cli search leaf # Search devices
242
+ nterm-cli device eng-leaf-1 # Device details
243
+ nterm-cli credentials --unlock # List credentials
244
+ nterm-cli --json devices # JSON output for scripting
245
+ ```
197
246
 
198
- The scripting API is the foundation for:
247
+ ### Key Features
199
248
 
200
- - **Command execution** `api.connect()` and `api.send()` for programmatic device interaction
201
- - **Batch operations** — Fan out commands across device groups
202
- - **MCP tool integration** Expose nterm capabilities to AI agents
249
+ | Feature | Description |
250
+ |---------|-------------|
251
+ | **Context Manager** | `with api.session()` auto-disconnects |
252
+ | **Platform-Aware** | `send_platform_command()` picks correct syntax |
253
+ | **Fallback Commands** | `send_first()` tries alternatives |
254
+ | **Structured Output** | TextFSM parsing to List[Dict] |
255
+ | **ANSI Filtering** | Clean output, no escape sequences |
256
+ | **Paging Detection** | Raises error if paging not disabled |
203
257
 
204
- See [scripting/README.md](nterm/scripting/README.md) for full API documentation.
258
+ See [scripting/README_API_IPython.md](nterm/scripting/README_API_IPython.md) for full API documentation.
259
+ See [scripting/README_REPL.md](nterm/scripting/README_REPL.md) for REPL documentation.
205
260
 
206
261
  ---
207
262
 
@@ -391,9 +446,14 @@ nterm/
391
446
  │ ├── resolver.py # Pattern-based resolution
392
447
  │ └── manager_ui.py # PyQt6 credential manager
393
448
  ├── manager/ # Session tree, connection dialogs
394
- └── scripting/ # API, CLI, automation support
395
- ├── api.py # NTermAPI class
396
- └── cli.py # nterm-cli entry point
449
+ └── scripting/ # API, REPL, automation support
450
+ ├── api.py # NTermAPI class
451
+ ├── models.py # ActiveSession, CommandResult, DeviceInfo
452
+ ├── platform_data.py # Platform commands and patterns
453
+ ├── platform_utils.py # Platform detection, extraction helpers
454
+ ├── ssh_connection.py # Low-level SSH with ANSI filtering
455
+ ├── repl.py # NTermREPL command router
456
+ └── repl_interactive.py # Interactive REPL display
397
457
  ```
398
458
 
399
459
  ---