🩺 Your Python program under the microscope – byte-code, memory & optional syscalls, with a live Streamlit dashboard.
Project description
PyXTrace
🩺 Your Python program under the microscope – in real time
Byte-code • Memory • (optional) Sys-call tracing | Rich CLI + live Streamlit dashboard
🗺️ Table of Contents
- ✨ Features
- 🚀 Installation
- 🕹️ Quick start
- 📂 Project layout
- 🛣️ Road-map
- 👩💻 Contributing
- ⚖️ License
- 🙏 Acknowledgements
✨ Features
| 🔍 What you see | 💡 Captured via | 📈 Visualised as (Streamlit) |
|---|---|---|
| Byte-code timeline | sys.settrace |
Cumulative line graph |
| Heap usage (kB) | tracemalloc snapshots |
Live line graph |
| Sys-calls (Linux) | strace -c -p … |
Cumulative line graph |
| Smart commentary | 1 s heuristics | Green console panel |
macOS & Linux fully supported.
Windows → byte-code + memory tracing (no strace).
🚀 Installation
# stable
pip install pyxtrace
# pre-release / nightly
pip install --pre pyxtrace
Optional extras
pip install pyxtrace # includes the Streamlit dashboard
pip install "pyxtrace[dev]" # black, ruff, mypy, pytest, …
Linux users – syscall tracing needs
straceand root:sudo apt install strace sudo pyxtrace --dash your_script.pyor skip sys-calls with
--no-syscalls.
🕹️ Quick start
# Rich CLI summary only
pyxtrace examples/fibonacci.py
# Live dashboard (opens http://127.0.0.1:8050)
pyxtrace --dash examples/fibonacci.py
# Pass cmd-line args to your script
pyxtrace --dash train.py -- --epochs 10 --lr 3e-4
# Performance presets
pyxtrace --mode demo script.py # call/return only (fastest)
pyxtrace --mode perf script.py # skip std-lib lines
pyxtrace --mode full script.py # trace everything (slowest)
When the dashboard opens, press ▶ Start to begin streaming events in real-time. A speed slider lets you throttle or accelerate the playback (10 – 500 events / s).
📂 Project layout
src/pyxtrace/
├─ cli.py ← Typer CLI entry-point
├─ core.py ← orchestration + JSONL replay
├─ bytecode.py ← byte-code tracer
├─ memory.py ← heap sampler (tracemalloc)
├─ syscalls/ ← syscall tracer (Linux / Darwin stubs)
├─ visual.py ← Rich summary + Streamlit dashboard
└─ …
🛣️ Road-map
| Status | Item |
|---|---|
| 🔄 | Flame-graph view (Chrome-style) |
| 🔄 | CPU sample profiler (perf hook) |
| 🔄 | Remote dashboard via websockets |
| 🔄 | VS Code extension |
| ✅ | Streamlit dashboard |
👩💻 Contributing
git clone https://github.com/AbhineetSaha/pyxtrace.git
cd pyxtrace
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install
- Create a feature branch from main
- Run
./dev_check.pyto execute the test suite and linters - Open a pull-request ❤️
⚖️ License
Released under the MIT License – see LICENSE.
🙏 Acknowledgements
| Project / Lib | Why it’s awesome |
|---|---|
| Rich & Typer | Beautiful CLIs with zero boiler-plate |
| Streamlit & Plotly | Interactive dashboards in pure Python |
| tracemalloc | Built-in heap sampler, criminally underrated |
| strace | Decades-old yet still magical |
…and you – for trying, starring ⭐ and contributing!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyxtrace-1.2.0.tar.gz.
File metadata
- Download URL: pyxtrace-1.2.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
789327d85216b70345b30d473f56e0f13e318a91570038cefe067b424d0e0fce
|
|
| MD5 |
4ccf694510c0f541bea63fa00c6eb944
|
|
| BLAKE2b-256 |
93659c40eb51b7e47fbe2bb2209851c3c940a902f75148257e41429fc88228ca
|
Provenance
The following attestation bundles were made for pyxtrace-1.2.0.tar.gz:
Publisher:
publish.yml on AbhineetSaha/pyxTrace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxtrace-1.2.0.tar.gz -
Subject digest:
789327d85216b70345b30d473f56e0f13e318a91570038cefe067b424d0e0fce - Sigstore transparency entry: 319091764
- Sigstore integration time:
-
Permalink:
AbhineetSaha/pyxTrace@e1855028937f39a9cb1ea617ae49dee0f715acc5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AbhineetSaha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e1855028937f39a9cb1ea617ae49dee0f715acc5 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyxtrace-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pyxtrace-1.2.0-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
717dcfb8e40be28776e55519d789e6d6c6ede7962d9e7eee7e4287cc73ec65e4
|
|
| MD5 |
778a7abfb19acd7f49907cc6c98c5beb
|
|
| BLAKE2b-256 |
e0edd70ade1fcce557e61bb0144f36005dd65ec731432b53173cc1cc95ebb7ae
|
Provenance
The following attestation bundles were made for pyxtrace-1.2.0-py3-none-any.whl:
Publisher:
publish.yml on AbhineetSaha/pyxTrace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxtrace-1.2.0-py3-none-any.whl -
Subject digest:
717dcfb8e40be28776e55519d789e6d6c6ede7962d9e7eee7e4287cc73ec65e4 - Sigstore transparency entry: 319091765
- Sigstore integration time:
-
Permalink:
AbhineetSaha/pyxTrace@e1855028937f39a9cb1ea617ae49dee0f715acc5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AbhineetSaha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e1855028937f39a9cb1ea617ae49dee0f715acc5 -
Trigger Event:
workflow_dispatch
-
Statement type: