This release is a pre-release and may not be stable for production use.
runit
A Python CLI tool to execute, monitor, and profile and visualize commands.
Project Purpose
This project was created to prove that advanced functionality is absolutely possible in the terminal. runit showcases real-time monitoring of child processes, delivers detailed resource reports, and is built with a strong emphasis on robust, well-tested code. The goal: bring a modern, delightful CLI experience to profiling command execution with charts and everything.
License
GPL v3. Please see the LICENSE file in the root of the repo for details.
Features
- Utilizes psutil for advanced resource tracking
- Reports execution time, system resource usage, threads, and child processes (including monitoring of all children)
- Terminal charts displaying CPU and memory usage
- Well tested
Demo
See runit in action:
Requirements
- Python 3.9+
- psutil
- plotext 5.x (
plotext>=5.3,<6). plotext 6 replaced the plotting API that runit uses, so it is not supported yet.
Installation
Clone this repository and install with pip:
git clone https://github.com/McIndi/runit.git
cd runit
python -m venv .venv
source .venv/bin/activate # Or (for Windows) .venv/Scripts/activate
pip install -e .
# Optionally run the tests
python test.py
Or, install directly from GitHub:
pip install git+https://github.com/McIndi/runit.git
After installation, use runit to run and analyze any command:
runit [args...] <command>
For example:
runit echo hello world
- If you run
runitwith no arguments, it will print help.
You'll receive a detailed resource usage report.
If plotext is installed and --plot is specified, terminal charts for CPU and memory usage over time will be displayed.
- Charts appear only if the child process runs long enough to gather data.
Example Output
=== runit report ===
Command: ['python', '-c', 'print(123)']
PID: 12345
Start Time: 2025-07-31 12:00:00.000000
End Time: 2025-07-31 12:00:01.000000
Duration: 0:00:01
Exit Code: 0
Max RSS (bytes): 12345678
Max Threads: 4
Max Children: 0
Samples: 10
If plotext is installed, you'll also see beautiful terminal charts for CPU and memory usage.
Run the Benchmarks
To run the benchmarks:
runit python benchmark.py
CLI Options
--log-level LEVEL: Set the logging level (default: INFO)--out-file FILE: Also write the report and charts to a file (they are still shown in the terminal)--strip-ansi: Remove ANSI escape codes from output file (for plain text files)--plot: If specified, attempt to plot CPU and memory usage--plot-width N,--plot-height N: Set the chart size (default: 80 x 20)command: The command to run and monitor
The output of the command goes to the terminal while it runs (stdout to stdout, stderr to stderr), with or without --out-file. When the command ends, runit shows the report, which also contains the captured stdout and stderr.
When using --out-file, the report and charts are both displayed in the terminal and written to the file. For plain text (no colors or terminal formatting), simply add --strip-ansi.
runit --out-file out.txt --strip-ansi python benchmark.py
You'll see the report and charts in your terminal, and a plain text version in out.txt.
Exit Status
runit exits with the exit code of the command, so you can use it in scripts and CI:
- The exit code of the command (for example,
runit falseexits with 1). - 128 + N when the command is stopped by signal N (for example, 143 for SIGTERM).
- 127 when the command is not found, and 126 when it cannot be executed (for example, no permission, or a script without a
#!line).
The Exit Code: line of the report shows the same value that runit exits with. For a signal, it also shows the signal, for example Exit Code: 143 (signal 15, SIGTERM).
If runit cannot write the --out-file file, it logs one error line. If the command failed, runit exits with the exit code of the command; if the command exited with 0, runit exits with 1. If runit cannot write the report to stdout (for example, a full disk), it logs one error line and exits with the exit code of the command. If the reader of stdout goes away (for example, runit yes | head), runit stops quietly. The --out-file file is written before the report goes to the terminal.
This behavior is new in 0.2.0. Releases up to 0.1.4 always exited with 0. If a script relies on that, use runit ... || true.
Development & Extending
Project Structure
The codebase is organized for clarity and extensibility:
runit/
├── __init__.py
├── cli.py # CLI handling: argparse setup and entrypoint
├── monitor.py # Process launching + stat collection logic
├── report.py # Summary formatter (text output)
├── plotting.py # CPU/memory plots via plotext
├── utils.py # Reusable helpers (ANSI stripping, extractors)
└── logging_config.py # Centralized logging setup
How to Add Features or Extend
- Add new measurements:
- Extend
monitor.pyto collect additional stats. - Add new extractors to
utils.py.
- Extend
- Change reporting:
- Update or add new formatters in
report.py.
- Update or add new formatters in
- Add new CLI options:
- Edit
cli.pyand itscreate_parser()function.
- Edit
- Add/modify plotting:
- Update
plotting.py(plotting is optional and gracefully degrades ifplotextis missing).
- Update
- Logging:
- All modules use a named logger for granular control. Adjust logging config in
logging_config.py. runit --out-file out.txt --strip-ansi python benchmark.py
- All modules use a named logger for granular control. Adjust logging config in
Tips for Contributors
- Each module should do one thing (separation of concerns).
- Avoid global state; keep functions pure where possible.
- Add tests for new features in
test.py. - Use dependency injection for flexibility (e.g., pass formatters or flags).
- Optional features should degrade gracefully (never crash if a dependency is missing).
Metadata
Release files for profiler-runit 0.2.0.post1.dev5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| profiler_runit-0.2.0.post1.dev5.tar.gz | 108.5 kB | With provenance | Details for profiler_runit-0.2.0.post1.dev5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| profiler_runit-0.2.0.post1.dev5-py3-none-any.whl | Python 3 | none | any | Details for profiler_runit-0.2.0.post1.dev5-py3-none-any.whl |
Total release size: 131.9 kB
Release files / profiler_runit-0.2.0.post1.dev5.tar.gz
| Download URL | profiler_runit-0.2.0.post1.dev5.tar.gz |
|---|---|
| Size | 108.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71f884e09af78553decb9c3cef335a30bfbb726421c160bdd96cdb977e6e3d00
|
|
BLAKE2b-256 checksum How to use checksums |
bc318656cacc8d048c049e36184b24a9ea6b4b33e4b5e22a48a6f2f8300b62c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / profiler_runit-0.2.0.post1.dev5-py3-none-any.whl
| Download URL | profiler_runit-0.2.0.post1.dev5-py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2db8f2d16d4154e141c0a44e1b5875d1ca25984d7b88976dc08ed257eae81141
|
|
BLAKE2b-256 checksum How to use checksums |
3bbeac4c3dacc85921da50e228b0246ec0aff546b93944a910cce462de4033e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logSecurity for profiler-runit 0.2.0.post1.dev5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for profiler_runit-0.2.0.post1.dev5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.