netshow 0.2.2__tar.gz → 0.3.0__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 (53) hide show
  1. netshow-0.3.0/.gitignore +11 -0
  2. netshow-0.3.0/PKG-INFO +154 -0
  3. netshow-0.3.0/README.md +126 -0
  4. netshow-0.3.0/docs/architecture.md +29 -0
  5. netshow-0.3.0/docs/assets/connections.svg +192 -0
  6. netshow-0.3.0/docs/assets/terminate.svg +193 -0
  7. netshow-0.3.0/docs/releasing.md +27 -0
  8. netshow-0.3.0/pyproject.toml +69 -0
  9. netshow-0.3.0/release.py +23 -0
  10. netshow-0.3.0/scripts/smoke_install.py +24 -0
  11. netshow-0.3.0/src/netshow/__init__.py +5 -0
  12. netshow-0.3.0/src/netshow/app.py +374 -0
  13. netshow-0.3.0/src/netshow/bandwidth.py +53 -0
  14. netshow-0.3.0/src/netshow/cli.py +36 -0
  15. netshow-0.3.0/src/netshow/collectors.py +166 -0
  16. netshow-0.3.0/src/netshow/connection_table.py +89 -0
  17. netshow-0.3.0/src/netshow/detail_screen.py +168 -0
  18. netshow-0.3.0/src/netshow/helpers.py +53 -0
  19. netshow-0.3.0/src/netshow/models.py +49 -0
  20. netshow-0.3.0/src/netshow/netshow.tcss +235 -0
  21. netshow-0.3.0/src/netshow/presentation.py +54 -0
  22. netshow-0.3.0/src/netshow/processes.py +115 -0
  23. netshow-0.3.0/src/netshow/terminate_screen.py +117 -0
  24. netshow-0.3.0/src/netshow/theme.py +31 -0
  25. netshow-0.3.0/tests/test_app.py +266 -0
  26. netshow-0.3.0/tests/test_bandwidth.py +49 -0
  27. netshow-0.3.0/tests/test_cli.py +29 -0
  28. netshow-0.3.0/tests/test_collectors.py +112 -0
  29. netshow-0.3.0/tests/test_presentation.py +18 -0
  30. netshow-0.3.0/tests/test_processes.py +92 -0
  31. netshow-0.3.0/uv.lock +531 -0
  32. netshow-0.2.2/.claude/settings.local.json +0 -8
  33. netshow-0.2.2/.github/workflows/python-app.yml +0 -66
  34. netshow-0.2.2/.gitignore +0 -1
  35. netshow-0.2.2/PKG-INFO +0 -217
  36. netshow-0.2.2/README.md +0 -185
  37. netshow-0.2.2/diffout.txt +0 -686
  38. netshow-0.2.2/github_netshow.png +0 -0
  39. netshow-0.2.2/how_to_per_proc_bw.md +0 -384
  40. netshow-0.2.2/netshow-logo.png +0 -0
  41. netshow-0.2.2/pyproject.toml +0 -101
  42. netshow-0.2.2/release.py +0 -192
  43. netshow-0.2.2/src/netshow/__init__.py +0 -3
  44. netshow-0.2.2/src/netshow/app.py +0 -570
  45. netshow-0.2.2/src/netshow/cli.py +0 -17
  46. netshow-0.2.2/src/netshow/detail_screen.py +0 -223
  47. netshow-0.2.2/src/netshow/helpers.py +0 -134
  48. netshow-0.2.2/src/netshow/styles.py +0 -313
  49. netshow-0.2.2/src/netshow/types_and_constants.py +0 -41
  50. netshow-0.2.2/uv.lock +0 -448
  51. {netshow-0.2.2 → netshow-0.3.0}/LICENSE +0 -0
  52. {netshow-0.2.2 → netshow-0.3.0}/tests/__init__.py +0 -0
  53. {netshow-0.2.2 → netshow-0.3.0}/tests/test_helpers.py +0 -0
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ .venv/
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ build/
7
+ dist/
8
+ *.egg-info/
9
+ .coverage
10
+ htmlcov/
11
+ .DS_Store
netshow-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.5
2
+ Name: netshow
3
+ Version: 0.3.0
4
+ Summary: An interactive, process-aware network monitor for your terminal
5
+ Project-URL: Homepage, https://github.com/taylorwilsdon/netshow
6
+ Project-URL: Issues, https://github.com/taylorwilsdon/netshow/issues
7
+ Author: Taylor Wilsdon
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: connections,monitoring,network,tui
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: System :: Networking :: Monitoring
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: psutil<8,>=7.2.2
25
+ Requires-Dist: rich<15,>=14.3
26
+ Requires-Dist: textual<9,>=8.2.8
27
+ Description-Content-Type: text/markdown
28
+
29
+ <div align="center">
30
+ <img width="50%" src="https://github.com/user-attachments/assets/51b8f028-2d25-4664-b4a1-44dcf9490140" alt="netshow" />
31
+
32
+ **Interactive, process-aware network monitoring for your terminal.**
33
+
34
+ Python 3.11+ · macOS & Linux · Built with Textual
35
+ </div>
36
+
37
+ ![Netshow connection monitor showing example connections](docs/assets/connections.svg)
38
+
39
+ > This checkout contains the UI refresh in development. Screenshots use example data.
40
+ > `uvx netshow` runs the published release; use the source instructions below to try this version.
41
+
42
+ ## Install and run
43
+
44
+ ```sh
45
+ uvx netshow
46
+ ```
47
+
48
+ For this development version:
49
+
50
+ ```sh
51
+ git clone https://github.com/taylorwilsdon/netshow.git
52
+ cd netshow
53
+ uv sync --locked
54
+ uv run netshow
55
+ ```
56
+
57
+ Or install the published package with `pipx install netshow`.
58
+
59
+ ## What it shows
60
+
61
+ - Live TCP connections with PID, friendly service name, process, endpoints, and status.
62
+ - Process details including executable, owner, command, working directory, threads, and live CPU/memory usage.
63
+ - Host or interface bandwidth: separate receive/transmit rates and a 30-second sparkline.
64
+ - Regex search across PID, names, addresses, and status; invalid patterns fall back to literal matching.
65
+ - Process/status sorting that preserves your selection, plus full IPv6 details.
66
+ - Confirmed process termination with a separate force-kill option if the process stays alive.
67
+ - The original Selenized Dark palette and labeled metric chips, built-in light/dark/ANSI themes, and a compact layout for small terminals.
68
+
69
+ Netshow tries psutil first and falls back to `lsof` when access is denied, as is common
70
+ on macOS. Install `lsof` if your system doesn't include it. Without sufficient privileges,
71
+ results may be incomplete; the status line marks limited visibility. Collection failures
72
+ show an error and retain the last successful snapshot, marked stale.
73
+
74
+ Bandwidth is measured for the entire host or chosen interface. It is **not per-process
75
+ or per-connection throughput**. Summing interfaces may count traffic at multiple layers
76
+ on hosts with bridges, tunnels, or virtual interfaces.
77
+
78
+ ## Usage
79
+
80
+ ```sh
81
+ netshow --interval 1.5
82
+ netshow --no-colors
83
+ netshow --version
84
+ ```
85
+
86
+ | Option | Behavior | Default |
87
+ | --- | --- | --- |
88
+ | `--interval SECONDS` | Positive, finite connection refresh interval | `3.0` |
89
+ | `--no-colors` | Monochrome rendering; also enabled by a nonempty `NO_COLOR` | Off |
90
+ | `--version` | Print installed version and exit | — |
91
+
92
+ Bandwidth samples every 0.5 seconds while the connection screen is visible.
93
+ Connection collection pauses during details/dialogs and resumes immediately on return.
94
+ Process details refresh every second while visible.
95
+
96
+ | Key | Action |
97
+ | --- | --- |
98
+ | ↑ / ↓ | Select a connection |
99
+ | Enter | Open selected connection details |
100
+ | Click | Highlight a row; click the highlighted row again to open details |
101
+ | Esc / ← | Return from details |
102
+ | Ctrl+R | Refresh the current connection/detail view |
103
+ | `/` / `f` | Open search / toggle search field |
104
+ | Enter in search | Return focus to the table |
105
+ | Esc in search | Hide the field; the active filter remains visible in the status line |
106
+ | `s` / `p` | Toggle status / process sorting; press again for default PID order |
107
+ | `i` | Cycle bandwidth interfaces |
108
+ | `e` | Toggle status symbols |
109
+ | `v` | Toggle full IPv6 addresses in the table |
110
+ | `k` | Confirm termination of the selected process |
111
+ | `?` | Toggle contextual keyboard help |
112
+ | Ctrl+P | Command palette, including theme selection |
113
+ | `q` / Ctrl+C | Quit |
114
+
115
+ Clear the search text to remove the filter. Settings last for the current session.
116
+ Single-letter shortcuts leave typing in the search field uninterrupted.
117
+
118
+ ## Terminate a process
119
+
120
+ Select a connection and press `k`, or use **Terminate process…** in its detail view.
121
+ The dialog identifies the process and defaults to **Cancel**. Confirming **Terminate**
122
+ sends SIGTERM and waits up to three seconds. If it remains alive, a second confirmation
123
+ offers **Force kill**, which sends SIGKILL. Netshow never escalates automatically.
124
+
125
+ ![Process termination confirmation using example data](docs/assets/terminate.svg)
126
+
127
+ The action affects the whole process and all its connections, so unsaved work may be
128
+ lost. Netshow rechecks PID and creation time before each signal, blocks unknown identities,
129
+ PID 0/1, and itself, and reports permission failures or exited/replaced processes.
130
+ It does not terminate process trees or request elevated privileges.
131
+
132
+ ## Development
133
+
134
+ ```sh
135
+ uv sync --locked
136
+ uv run ruff format --check .
137
+ uv run ruff check .
138
+ uv run mypy src
139
+ uv run pytest -q
140
+ uv build
141
+ ```
142
+
143
+ Run `uv run ruff format .` to format changes. CI tests Python 3.11–3.14 on Linux and
144
+ Python 3.14 on macOS, and verifies installations from both wheel and source artifacts.
145
+ Tests use synthetic connection data; process-control integration tests act only on
146
+ children they start themselves.
147
+
148
+ See [architecture](docs/architecture.md) and [release instructions](docs/releasing.md).
149
+ The earlier published version remains available for Python 3.9/3.10 users.
150
+
151
+ ## License
152
+
153
+ [MIT](LICENSE). Issues and contributions are welcome on
154
+ [GitHub](https://github.com/taylorwilsdon/netshow/issues).
@@ -0,0 +1,126 @@
1
+ <div align="center">
2
+ <img width="50%" src="https://github.com/user-attachments/assets/51b8f028-2d25-4664-b4a1-44dcf9490140" alt="netshow" />
3
+
4
+ **Interactive, process-aware network monitoring for your terminal.**
5
+
6
+ Python 3.11+ · macOS & Linux · Built with Textual
7
+ </div>
8
+
9
+ ![Netshow connection monitor showing example connections](docs/assets/connections.svg)
10
+
11
+ > This checkout contains the UI refresh in development. Screenshots use example data.
12
+ > `uvx netshow` runs the published release; use the source instructions below to try this version.
13
+
14
+ ## Install and run
15
+
16
+ ```sh
17
+ uvx netshow
18
+ ```
19
+
20
+ For this development version:
21
+
22
+ ```sh
23
+ git clone https://github.com/taylorwilsdon/netshow.git
24
+ cd netshow
25
+ uv sync --locked
26
+ uv run netshow
27
+ ```
28
+
29
+ Or install the published package with `pipx install netshow`.
30
+
31
+ ## What it shows
32
+
33
+ - Live TCP connections with PID, friendly service name, process, endpoints, and status.
34
+ - Process details including executable, owner, command, working directory, threads, and live CPU/memory usage.
35
+ - Host or interface bandwidth: separate receive/transmit rates and a 30-second sparkline.
36
+ - Regex search across PID, names, addresses, and status; invalid patterns fall back to literal matching.
37
+ - Process/status sorting that preserves your selection, plus full IPv6 details.
38
+ - Confirmed process termination with a separate force-kill option if the process stays alive.
39
+ - The original Selenized Dark palette and labeled metric chips, built-in light/dark/ANSI themes, and a compact layout for small terminals.
40
+
41
+ Netshow tries psutil first and falls back to `lsof` when access is denied, as is common
42
+ on macOS. Install `lsof` if your system doesn't include it. Without sufficient privileges,
43
+ results may be incomplete; the status line marks limited visibility. Collection failures
44
+ show an error and retain the last successful snapshot, marked stale.
45
+
46
+ Bandwidth is measured for the entire host or chosen interface. It is **not per-process
47
+ or per-connection throughput**. Summing interfaces may count traffic at multiple layers
48
+ on hosts with bridges, tunnels, or virtual interfaces.
49
+
50
+ ## Usage
51
+
52
+ ```sh
53
+ netshow --interval 1.5
54
+ netshow --no-colors
55
+ netshow --version
56
+ ```
57
+
58
+ | Option | Behavior | Default |
59
+ | --- | --- | --- |
60
+ | `--interval SECONDS` | Positive, finite connection refresh interval | `3.0` |
61
+ | `--no-colors` | Monochrome rendering; also enabled by a nonempty `NO_COLOR` | Off |
62
+ | `--version` | Print installed version and exit | — |
63
+
64
+ Bandwidth samples every 0.5 seconds while the connection screen is visible.
65
+ Connection collection pauses during details/dialogs and resumes immediately on return.
66
+ Process details refresh every second while visible.
67
+
68
+ | Key | Action |
69
+ | --- | --- |
70
+ | ↑ / ↓ | Select a connection |
71
+ | Enter | Open selected connection details |
72
+ | Click | Highlight a row; click the highlighted row again to open details |
73
+ | Esc / ← | Return from details |
74
+ | Ctrl+R | Refresh the current connection/detail view |
75
+ | `/` / `f` | Open search / toggle search field |
76
+ | Enter in search | Return focus to the table |
77
+ | Esc in search | Hide the field; the active filter remains visible in the status line |
78
+ | `s` / `p` | Toggle status / process sorting; press again for default PID order |
79
+ | `i` | Cycle bandwidth interfaces |
80
+ | `e` | Toggle status symbols |
81
+ | `v` | Toggle full IPv6 addresses in the table |
82
+ | `k` | Confirm termination of the selected process |
83
+ | `?` | Toggle contextual keyboard help |
84
+ | Ctrl+P | Command palette, including theme selection |
85
+ | `q` / Ctrl+C | Quit |
86
+
87
+ Clear the search text to remove the filter. Settings last for the current session.
88
+ Single-letter shortcuts leave typing in the search field uninterrupted.
89
+
90
+ ## Terminate a process
91
+
92
+ Select a connection and press `k`, or use **Terminate process…** in its detail view.
93
+ The dialog identifies the process and defaults to **Cancel**. Confirming **Terminate**
94
+ sends SIGTERM and waits up to three seconds. If it remains alive, a second confirmation
95
+ offers **Force kill**, which sends SIGKILL. Netshow never escalates automatically.
96
+
97
+ ![Process termination confirmation using example data](docs/assets/terminate.svg)
98
+
99
+ The action affects the whole process and all its connections, so unsaved work may be
100
+ lost. Netshow rechecks PID and creation time before each signal, blocks unknown identities,
101
+ PID 0/1, and itself, and reports permission failures or exited/replaced processes.
102
+ It does not terminate process trees or request elevated privileges.
103
+
104
+ ## Development
105
+
106
+ ```sh
107
+ uv sync --locked
108
+ uv run ruff format --check .
109
+ uv run ruff check .
110
+ uv run mypy src
111
+ uv run pytest -q
112
+ uv build
113
+ ```
114
+
115
+ Run `uv run ruff format .` to format changes. CI tests Python 3.11–3.14 on Linux and
116
+ Python 3.14 on macOS, and verifies installations from both wheel and source artifacts.
117
+ Tests use synthetic connection data; process-control integration tests act only on
118
+ children they start themselves.
119
+
120
+ See [architecture](docs/architecture.md) and [release instructions](docs/releasing.md).
121
+ The earlier published version remains available for Python 3.9/3.10 users.
122
+
123
+ ## License
124
+
125
+ [MIT](LICENSE). Issues and contributions are welcome on
126
+ [GitHub](https://github.com/taylorwilsdon/netshow/issues).
@@ -0,0 +1,29 @@
1
+ # Architecture
2
+
3
+ `NetshowApp` owns the theme, command palette, and screen stack. `ConnectionsScreen`
4
+ owns a complete immutable snapshot plus filter/sort state. One collection worker runs
5
+ at a time; refresh requests coalesce. Suspending the screen invalidates in-flight
6
+ results, and resuming triggers a fresh collection. Collection errors retain the last
7
+ successful snapshot and show its stale status.
8
+
9
+ Collectors normalize psutil and NUL-delimited lsof output into `Connection` records.
10
+ Each refresh reuses process metadata for repeated PIDs. Docker discovery is bounded
11
+ and cached for 30 seconds. A non-root collector may see only part of the system;
12
+ netshow states this explicitly. lsof and Docker commands have timeouts.
13
+
14
+ `ConnectionTable` maps row keys to records. Formatting never becomes the source of
15
+ process identity or addresses. Filtering/sorting operate locally; table updates preserve
16
+ selection by identity and update only changed cells. TCSS uses Textual theme variables.
17
+
18
+ `BandwidthSampler` owns a separate counter baseline and 60-sample history. A single
19
+ worker samples every half-second while the connection screen is active. Rendering and
20
+ resizing never sample counters. RX/TX are host/interface totals, not process throughput.
21
+
22
+ `ProcessInspector` retains its CPU baseline and reports unavailable fields individually.
23
+ Termination uses PID plus creation time, revalidated before every signal. The confirmation
24
+ screen submits at most one request at a time. A timeout offers a new explicit force-kill
25
+ confirmation with Cancel focused. Process trees and privilege escalation are unsupported.
26
+
27
+ Tests use deterministic collection fixtures and Textual Pilot. Only the explicit child
28
+ integration tests signal real processes, and those processes are created by the tests.
29
+ `scripts/smoke_install.py` verifies metadata, packaged TCSS, and startup from built artifacts.