# 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
```bash
pip install clinic-py
```
## Quick Start
### Monitor a Python script
```bash
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
```bash
python -m clinic_py serve
```
Then open http://localhost:8000 in your browser to explore the performance data.
## Usage
### Command Line Interface
```bash
# 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:
1. **Resource Sampling**: Collects CPU time, memory usage, I/O counters using `getrusage()`
2. **Stack Sampling**: Analyzes Python call stacks to categorize code execution
3. **Binary Storage**: Writes metrics to efficient binary format
4. **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.
Raw data
{
"_id": null,
"home_page": null,
"name": "clinic-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "performance, monitoring, metrics, python, profiling, clinic",
"author": "fullzer4",
"author_email": "fullzer4 <gabrielpelizzaro@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/06/6c/0ae895aa3645112d9d1ef729d059c7cdd44788265ed734713aabf5971c0b/clinic_py-0.1.0.tar.gz",
"platform": null,
"description": "# clinic-py\n\nNon-invasive performance metrics collection for Python applications, inspired by Node.js clinic.\n\n## Features\n\n- **Non-invasive monitoring**: Collect performance metrics without modifying your code\n- **System metrics**: CPU usage, memory consumption, I/O operations, context switches\n- **Python stack analysis**: Categorize frames into application, library, and core code\n- **Binary metrics format**: Efficient storage and parsing of performance data\n- **Web dashboard**: Interactive visualization of collected metrics\n- **Cross-platform**: Supports Linux, macOS, and other Unix-like systems\n\n## Installation\n\n```bash\npip install clinic-py\n```\n\n## Quick Start\n\n### Monitor a Python script\n\n```bash\npython -m clinic_py run your_script.py\n```\n\nThis will execute your script and collect performance metrics in the `.clinic_py/` directory.\n\n### View results in web dashboard\n\n```bash\npython -m clinic_py serve\n```\n\nThen open http://localhost:8000 in your browser to explore the performance data.\n\n## Usage\n\n### Command Line Interface\n\n```bash\n# Run a script under monitoring\npython -m clinic_py run [--outdir DIR] script.py\n\n# Serve web dashboard\npython -m clinic_py serve [--outdir DIR] [--port PORT]\n```\n\n### Options\n\n- `--outdir`: Directory where metrics are stored (default: `.clinic_py`)\n- `--port`: Port for the web dashboard (default: 8000)\n\n## How it Works\n\nclinic-py uses a C extension to periodically sample system resources with minimal overhead:\n\n1. **Resource Sampling**: Collects CPU time, memory usage, I/O counters using `getrusage()`\n2. **Stack Sampling**: Analyzes Python call stacks to categorize code execution\n3. **Binary Storage**: Writes metrics to efficient binary format\n4. **Web Visualization**: Provides interactive charts and summaries\n\n## Requirements\n\n- Python 3.9+\n- Unix-like operating system (Linux, macOS, etc.)\n- C compiler for building the extension\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues and pull requests.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Non\u2011invasive performance metrics collection for Python",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/fullzer4/clinic-py#readme",
"Homepage": "https://github.com/fullzer4/clinic-py",
"Issues": "https://github.com/fullzer4/clinic-py/issues",
"Repository": "https://github.com/fullzer4/clinic-py"
},
"split_keywords": [
"performance",
" monitoring",
" metrics",
" python",
" profiling",
" clinic"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "066c0ae895aa3645112d9d1ef729d059c7cdd44788265ed734713aabf5971c0b",
"md5": "0422ff8e8f0e4c653927adff6776ef68",
"sha256": "eebae4299b08245592457a1929725d1d8040b49090b96f67b4c4d11d91295be7"
},
"downloads": -1,
"filename": "clinic_py-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0422ff8e8f0e4c653927adff6776ef68",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 16900,
"upload_time": "2025-07-25T13:51:13",
"upload_time_iso_8601": "2025-07-25T13:51:13.438539Z",
"url": "https://files.pythonhosted.org/packages/06/6c/0ae895aa3645112d9d1ef729d059c7cdd44788265ed734713aabf5971c0b/clinic_py-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-25 13:51:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fullzer4",
"github_project": "clinic-py#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "clinic-py"
}