stage-tracker
A lightweight, zero-dependency Python library for tracking multi-stage pipeline executions.
stage-tracker helps developers log structured run metadata, track stage durations, and debug complex flows — all with minimal effort.
📦 What is stage-tracker?
When you're running a pipeline — whether in AI research, cybersecurity defense, data processing, or experimentation — it's critical to:
- Capture what ran
- When it ran
- How long it took
- What went wrong (or right)
stage-tracker simplifies this with structured JSON output that records:
- Pipeline-level metadata (e.g., run ID, args, start/end time)
- Named stages, each with start time, duration, output data, and error info
This makes your system observable, auditable, and debuggable.
✨ Features
- 🔹 UUID-based
run_idfor traceability - 🕒 ISO-formatted timestamps with timezone
- 📊 Track multiple stages independently or sequentially
- 💥 Record exception/error messages per stage
- 📁 Save output as a structured JSON file
- 🧼 Minimal, clean API with no third-party dependencies
🧑💻 Installation
pip install stage-tracker
🚀 Quick Start
from stage_tracker import Tracker
# Initialize a tracker for a given run
tracker = Tracker(args="Reconnaissance_M1")
# Track stages
tracker.start_stage("Detection")
# ... run detection logic ...
tracker.end_stage("Detection", data={"status": "clean"})
tracker.start_stage("Enrichment")
# ... enrichment logic ...
tracker.end_stage("Enrichment", data={"added_cves": 3})
# Finalize and save
tracker.finalize("run_output.json")
Output (run_output.json):
{
"run_id": "af3c980c-3d22-46e8-83cd-7ff99abee586",
"start_time": "2025-05-05T23:14:10.235518+00:00",
"args": "Reconnaissance_M1",
"stages": {
"Detection": {
"start_time": "...",
"duration_sec": 3.42,
"data": {"status": "clean"},
"error": null
},
"Enrichment": {
"start_time": "...",
"duration_sec": 1.01,
"data": {"added_cves": 3},
"error": null
}
},
"completed_at": "...",
"total_duration_sec": 9.42
}
🧩 Use Cases
- 🔍 AI/ML Experiments: Measure durations of preprocessing, training, evaluation.
- 🛡 Cybersecurity Pipelines: Log detection, enrichment, and mitigation stages.
- ⚙️ ETL/Batch Jobs: Trace and debug stage-level runtime or failures.
- 📄 Paper Reproducibility: Attach structured logs for each experiment run.
🛠 How It Works
- Instantiate
Tracker(args=...) - For each stage:
- Call
start_stage("StageName") - Run logic
- Call
end_stage("StageName", data=..., error=...)
- Call
- When done, call
tracker.finalize("output.json")
Internally, it tracks timestamps, computes durations, and writes JSON output.
📂 Project Structure
stage-tracker/
├── stage_tracker/
│ ├── __init__.py
│ └── tracker.py
├── pyproject.toml
├── LICENSE
└── README.md
📄 License
This project is licensed under the MIT License — see the LICENSE file for details.
🤝 Contributing
Pull requests are welcome. Feel free to fork and improve! If you find a bug or want to request a feature, please open an issue and I'll do my best to review and address issues promptly.
📬 Contact
Maintained by Karim Ahmed.
Email: karim.ahmed4815@gmail.com
GitHub: rexmirak
Metadata
Release files for stage-tracker 0.1.1
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 | |
|---|---|---|---|---|
| stage_tracker-0.1.1.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stage_tracker-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / stage_tracker-0.1.1.tar.gz
| Download URL | stage_tracker-0.1.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2eb73bda16f40fe525ff843ea4be53ec9e57821b977647187321b63793cfe72d
|
|
BLAKE2b-256 checksum How to use checksums |
7f5f40079df33de52ea76cc10fb45970fadfe37b8dda3b4bd20c22b2d5fbe570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Release files / stage_tracker-0.1.1-py3-none-any.whl
| Download URL | stage_tracker-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ddd132ac635e1baa66261ca480fc29ce455fd968f6db9bdbc01d6fd2f5b618f
|
|
BLAKE2b-256 checksum How to use checksums |
77d5c2d726a22174d17fb98a4ac4ef9fd717c78812532078856a43daaaf727e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Security for stage-tracker 0.1.1
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.