clinic-py
Non-invasive performance metrics collection for Python applications, inspired by Node.js clinic.
Features
- Non-invasive monitoring: Collect performance metrics without modifying your code
- System metrics: CPU usage, memory consumption, I/O operations, context switches
- Python stack analysis: Categorize frames into application, library, and core code
- Binary metrics format: Efficient storage and parsing of performance data
- Web dashboard: Interactive visualization of collected metrics
- Cross-platform: Supports Linux, macOS, and other Unix-like systems
Installation
pip install clinic-py
Quick Start
Monitor a Python script
python -m clinic_py run your_script.py
This will execute your script and collect performance metrics in the .clinic_py/ directory.
View results in web dashboard
python -m clinic_py serve
Then open http://localhost:8000 in your browser to explore the performance data.
Usage
Command Line Interface
# Run a script under monitoring
python -m clinic_py run [--outdir DIR] script.py
# Serve web dashboard
python -m clinic_py serve [--outdir DIR] [--port PORT]
Options
--outdir: Directory where metrics are stored (default:.clinic_py)--port: Port for the web dashboard (default: 8000)
How it Works
clinic-py uses a C extension to periodically sample system resources with minimal overhead:
- Resource Sampling: Collects CPU time, memory usage, I/O counters using
getrusage() - Stack Sampling: Analyzes Python call stacks to categorize code execution
- Binary Storage: Writes metrics to efficient binary format
- Web Visualization: Provides interactive charts and summaries
Requirements
- Python 3.9+
- Unix-like operating system (Linux, macOS, etc.)
- C compiler for building the extension
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Metadata
Release files for clinic-py 0.1.0
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 |
|---|---|---|---|---|
| clinic_py-0.1.0.tar.gz | 16.9 kB | Without provenance | Details for clinic_py-0.1.0.tar.gz |
Release files / clinic_py-0.1.0.tar.gz
| Download URL | clinic_py-0.1.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eebae4299b08245592457a1929725d1d8040b49090b96f67b4c4d11d91295be7
|
|
BLAKE2b-256 checksum How to use checksums |
066c0ae895aa3645112d9d1ef729d059c7cdd44788265ed734713aabf5971c0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.5
|
Security for clinic-py 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.