ptop3 0.1.1__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.
ptop3-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ptop3-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: ptop3
3
+ Version: 0.1.1
4
+ Summary: TUI process monitor that groups processes by application
5
+ License: MIT
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: psutil>=5.9
10
+ Provides-Extra: dev
11
+ Requires-Dist: pytest>=7; extra == "dev"
12
+ Requires-Dist: pytest-cov; extra == "dev"
13
+ Requires-Dist: ruff; extra == "dev"
14
+ Requires-Dist: mypy; extra == "dev"
15
+ Requires-Dist: bump-my-version; extra == "dev"
16
+ Dynamic: license-file
17
+
18
+ # ptop3
19
+
20
+ [![PyPI version](https://img.shields.io/pypi/v/ptop3.svg)](https://pypi.org/project/ptop3/)
21
+ [![Python versions](https://img.shields.io/pypi/pyversions/ptop3.svg)](https://pypi.org/project/ptop3/)
22
+ [![CI](https://github.com/spazyCZ/ptop3/actions/workflows/ci.yml/badge.svg)](https://github.com/spazyCZ/ptop3/actions)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
24
+
25
+ An htop-like TUI process monitor that groups processes by application.
26
+
27
+ ## Screenshots
28
+
29
+ ![Group view](assets/printscreen_main.png)
30
+ *Main group view — processes grouped by application*
31
+
32
+ ![Detail view](assets/Screenshot_group.png)
33
+ *Detail view — individual processes for a selected group*
34
+
35
+ ![Tree view](assets/Screenshot_group_tree.png)
36
+ *Tree view — process hierarchy within a group*
37
+
38
+ ## Features
39
+
40
+ - Groups processes by application name with smart alias resolution
41
+ - Colored header with memory, swap, load-average badges
42
+ - Sort by memory, CPU, RSS, swap, I/O, network, or count
43
+ - Regex filter across app name, process name, and cmdline
44
+ - Process tree view within a selected application group
45
+ - Kill signals (SIGTERM / SIGKILL) for individual processes or entire groups
46
+ - `w` key: clean swap by cycling swapoff/swapon (passwordless sudo)
47
+ - `d` key: drop kernel caches (passwordless sudo)
48
+ - Alerts for high CPU, memory, swap, disk usage, and zombie processes
49
+ - Lite mode (`--lite`) for lower overhead on busy systems
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install ptop3
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ ```bash
60
+ ptop3 # interactive TUI
61
+ python -m ptop3 # same via module
62
+ ptop3 --once # print one-shot table and exit
63
+ ptop3 --filter python # filter to python processes
64
+ ```
65
+
66
+ ## Sudo Setup
67
+
68
+ The `w` (swap-clean) and `d` (drop-caches) keys require root. Configure passwordless sudo once:
69
+
70
+ ```bash
71
+ sudo ptop3 --init-subscripts
72
+ ```
73
+
74
+ Or manually:
75
+
76
+ ```bash
77
+ sudo visudo -f /etc/sudoers.d/ptop3
78
+ # Add:
79
+ # YOUR_USER ALL=(root) NOPASSWD: /path/to/ptop3-drop-caches
80
+ # YOUR_USER ALL=(root) NOPASSWD: /path/to/ptop3-swap-clean
81
+ ```
82
+
83
+ Check sudo status:
84
+
85
+ ```bash
86
+ ptop3 --check-sudo
87
+ ```
88
+
89
+ ## CLI Reference
90
+
91
+ | Flag | Default | Description |
92
+ |------|---------|-------------|
93
+ | `--once` | off | Print one-shot table and exit |
94
+ | `-f/--filter REGEX` | — | Filter by app/name/cmdline |
95
+ | `-s/--sort KEY` | `mem` | Sort key: mem, cpu, rss, swap, io, net, count |
96
+ | `-n/--top N` | 15 | Rows to show in `--once` mode |
97
+ | `--refresh SECS` | 2.0 | Refresh interval |
98
+ | `--lite` | off | Lite mode: skip cmdline/IO for tiny procs |
99
+ | `--check-sudo` | — | Check sudo config for subscripts |
100
+ | `--init-subscripts` | — | Write /etc/sudoers.d/ptop3 |
101
+
102
+ ## Key Bindings
103
+
104
+ | Key | Action |
105
+ |-----|--------|
106
+ | `↑/↓` or `j/k` | Move selection |
107
+ | `PgUp/PgDn` | Page up/down |
108
+ | `Home/End` | Jump to first/last |
109
+ | `Enter` or `l` | Expand group to detail view |
110
+ | `h` | Back to group view |
111
+ | `t` | Toggle process tree (detail view) |
112
+ | `s` | Cycle sort key |
113
+ | `f` | Enter filter regex |
114
+ | `r` | Reset filter |
115
+ | `+/-` | Increase/decrease refresh interval |
116
+ | `k/K` | Send SIGTERM/SIGKILL to selected |
117
+ | `g` | Kill whole group (SIGTERM) |
118
+ | `w` | Run swap-clean |
119
+ | `d` | Drop caches |
120
+ | `q` or `Ctrl-C` | Quit |
121
+
122
+ ## Subscripts
123
+
124
+ The privileged subscripts can also be run directly:
125
+
126
+ ```bash
127
+ ptop3-drop-caches --help
128
+ ptop3-drop-caches --level 1 --dry-run
129
+
130
+ ptop3-swap-clean --help
131
+ ptop3-swap-clean --safety-mb 256 --dry-run
132
+ ```
133
+
134
+ ## Development
135
+
136
+ ```bash
137
+ git clone https://github.com/yourusername/ptop3
138
+ cd ptop3
139
+ pip install -e ".[dev]"
140
+ pytest
141
+ ruff check ptop3/
142
+ ```
ptop3-0.1.1/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # ptop3
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/ptop3.svg)](https://pypi.org/project/ptop3/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/ptop3.svg)](https://pypi.org/project/ptop3/)
5
+ [![CI](https://github.com/spazyCZ/ptop3/actions/workflows/ci.yml/badge.svg)](https://github.com/spazyCZ/ptop3/actions)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+
8
+ An htop-like TUI process monitor that groups processes by application.
9
+
10
+ ## Screenshots
11
+
12
+ ![Group view](assets/printscreen_main.png)
13
+ *Main group view — processes grouped by application*
14
+
15
+ ![Detail view](assets/Screenshot_group.png)
16
+ *Detail view — individual processes for a selected group*
17
+
18
+ ![Tree view](assets/Screenshot_group_tree.png)
19
+ *Tree view — process hierarchy within a group*
20
+
21
+ ## Features
22
+
23
+ - Groups processes by application name with smart alias resolution
24
+ - Colored header with memory, swap, load-average badges
25
+ - Sort by memory, CPU, RSS, swap, I/O, network, or count
26
+ - Regex filter across app name, process name, and cmdline
27
+ - Process tree view within a selected application group
28
+ - Kill signals (SIGTERM / SIGKILL) for individual processes or entire groups
29
+ - `w` key: clean swap by cycling swapoff/swapon (passwordless sudo)
30
+ - `d` key: drop kernel caches (passwordless sudo)
31
+ - Alerts for high CPU, memory, swap, disk usage, and zombie processes
32
+ - Lite mode (`--lite`) for lower overhead on busy systems
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install ptop3
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ```bash
43
+ ptop3 # interactive TUI
44
+ python -m ptop3 # same via module
45
+ ptop3 --once # print one-shot table and exit
46
+ ptop3 --filter python # filter to python processes
47
+ ```
48
+
49
+ ## Sudo Setup
50
+
51
+ The `w` (swap-clean) and `d` (drop-caches) keys require root. Configure passwordless sudo once:
52
+
53
+ ```bash
54
+ sudo ptop3 --init-subscripts
55
+ ```
56
+
57
+ Or manually:
58
+
59
+ ```bash
60
+ sudo visudo -f /etc/sudoers.d/ptop3
61
+ # Add:
62
+ # YOUR_USER ALL=(root) NOPASSWD: /path/to/ptop3-drop-caches
63
+ # YOUR_USER ALL=(root) NOPASSWD: /path/to/ptop3-swap-clean
64
+ ```
65
+
66
+ Check sudo status:
67
+
68
+ ```bash
69
+ ptop3 --check-sudo
70
+ ```
71
+
72
+ ## CLI Reference
73
+
74
+ | Flag | Default | Description |
75
+ |------|---------|-------------|
76
+ | `--once` | off | Print one-shot table and exit |
77
+ | `-f/--filter REGEX` | — | Filter by app/name/cmdline |
78
+ | `-s/--sort KEY` | `mem` | Sort key: mem, cpu, rss, swap, io, net, count |
79
+ | `-n/--top N` | 15 | Rows to show in `--once` mode |
80
+ | `--refresh SECS` | 2.0 | Refresh interval |
81
+ | `--lite` | off | Lite mode: skip cmdline/IO for tiny procs |
82
+ | `--check-sudo` | — | Check sudo config for subscripts |
83
+ | `--init-subscripts` | — | Write /etc/sudoers.d/ptop3 |
84
+
85
+ ## Key Bindings
86
+
87
+ | Key | Action |
88
+ |-----|--------|
89
+ | `↑/↓` or `j/k` | Move selection |
90
+ | `PgUp/PgDn` | Page up/down |
91
+ | `Home/End` | Jump to first/last |
92
+ | `Enter` or `l` | Expand group to detail view |
93
+ | `h` | Back to group view |
94
+ | `t` | Toggle process tree (detail view) |
95
+ | `s` | Cycle sort key |
96
+ | `f` | Enter filter regex |
97
+ | `r` | Reset filter |
98
+ | `+/-` | Increase/decrease refresh interval |
99
+ | `k/K` | Send SIGTERM/SIGKILL to selected |
100
+ | `g` | Kill whole group (SIGTERM) |
101
+ | `w` | Run swap-clean |
102
+ | `d` | Drop caches |
103
+ | `q` or `Ctrl-C` | Quit |
104
+
105
+ ## Subscripts
106
+
107
+ The privileged subscripts can also be run directly:
108
+
109
+ ```bash
110
+ ptop3-drop-caches --help
111
+ ptop3-drop-caches --level 1 --dry-run
112
+
113
+ ptop3-swap-clean --help
114
+ ptop3-swap-clean --safety-mb 256 --dry-run
115
+ ```
116
+
117
+ ## Development
118
+
119
+ ```bash
120
+ git clone https://github.com/yourusername/ptop3
121
+ cd ptop3
122
+ pip install -e ".[dev]"
123
+ pytest
124
+ ruff check ptop3/
125
+ ```
@@ -0,0 +1,5 @@
1
+ __version__ = "0.1.1"
2
+
3
+ from ptop3.monitor import aggregate, get_proc_rows, normalize_app_name
4
+
5
+ __all__ = ["get_proc_rows", "aggregate", "normalize_app_name", "__version__"]
@@ -0,0 +1,3 @@
1
+ from ptop3.monitor import main
2
+
3
+ main()