Skip to main content

🩺 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

PyPI License CI
Downloads

Byte-code • Memory • (optional) Sys-call tracing  |  Rich CLI + live Streamlit dashboard


Demo animation

🗺️ Table of Contents


✨ 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 strace and root:

sudo apt install strace
sudo pyxtrace --dash your_script.py

or 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
  1. Create a feature branch from main
  2. Run ./dev_check.py to execute the test suite and linters
  3. 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

pyxtrace-1.2.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyxtrace-1.2.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

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

Hashes for pyxtrace-1.2.0.tar.gz
Algorithm Hash digest
SHA256 789327d85216b70345b30d473f56e0f13e318a91570038cefe067b424d0e0fce
MD5 4ccf694510c0f541bea63fa00c6eb944
BLAKE2b-256 93659c40eb51b7e47fbe2bb2209851c3c940a902f75148257e41429fc88228ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxtrace-1.2.0.tar.gz:

Publisher: publish.yml on AbhineetSaha/pyxTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pyxtrace-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 717dcfb8e40be28776e55519d789e6d6c6ede7962d9e7eee7e4287cc73ec65e4
MD5 778a7abfb19acd7f49907cc6c98c5beb
BLAKE2b-256 e0edd70ade1fcce557e61bb0144f36005dd65ec731432b53173cc1cc95ebb7ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxtrace-1.2.0-py3-none-any.whl:

Publisher: publish.yml on AbhineetSaha/pyxTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page