A zero-configuration execution recorder for Python
Project description
blackbox-recorder
A zero‑configuration execution recorder for Python.
Know what your code actually did, even when it fails silently.
Problem
Python code can fail silently:
- exceptions are swallowed (
try/except: pass) - functions return
Noneunexpectedly - control flow diverges from what you expected
Logs and debuggers only help if you already know where to look.
blackboxpy answers a different question:
After my program ran, what actually happened?
Not guesses. Not logs you forgot to add. Actual execution evidence.
Quick Start
Install
pip install blackbox-recorder
Use (3 lines)
import blackbox_recorder
blackbox_recorder.start()
# ... your code runs here ...
blackbox_recorder.stop()
blackbox_recorder.report()
Output
Execution Summary
----------------------------------------------------------------------
process_data | called 3x | avg 12.3ms | 1 exception(s)
validate_input | called 6x | avg 0.1ms | ok
transform_payload | called 5x | avg 0.4ms | returned None 1x
Exceptions
----------------------------------------------------------------------
process_data → ValueError('invalid format')
No configuration. No code changes. Just evidence.
What It Is (and Is Not)
| It IS | It is NOT |
|---|---|
| A passive execution recorder | A debugger |
| Zero‑configuration | A profiler |
| Post‑mortem friendly | An observability platform |
| Lightweight and local | An AI tool |
| Zero dependencies (stdlib only) | Distributed tracing system |
Think flight recorder, not live cockpit controls.
Note: Only uses Python standard library. No external packages required.
Features
v0.1: Core
- Records function calls, timing, exceptions, returns
- Captures swallowed exceptions
- Human‑readable summary report
- Save reports to file (with append mode)
v0.2: Insight
- Chronological execution timeline
- Shallow argument capture
- Shallow return value capture
- JSON export
v0.3: Control
- CLI:
blackbox-recorder run script.py - Module include/exclude filters
configure()API
v0.4: Scale
- Async/await support
- Sampling mode (trace a fraction of calls)
- Automatic disk persistence
All versions are backward‑compatible.
API Reference
For complete and detailed API documentation (including all function signatures, parameters, examples, classes, CLI options, use cases, and troubleshooting), see:
📖 Full API Documentation
Quick links:
- Core Functions:
start(),stop(),report(),timeline(),save_report(),save_json(),configure() - Context Manager:
Recorder - Async Support:
get_async_tracer() - Low-Level Classes:
Tracer,ExecutionData,TimelineEvent,AsyncTracer,Config - CLI Reference:
blackbox-recorder runwith examples - Use Cases: Debugging, performance, production, testing
- Troubleshooting & FAQ: 13 Q&As
Intended Users
- Backend developers
- Script authors
- Data engineers
- Anyone debugging code without perfect logs
Not designed for high‑traffic production systems (yet).
Non‑Goals
- Replacing debuggers
- Replacing logging
- Real‑time visualization
- Distributed tracing
Project Info
- Version: 0.4.2
- Stability: Alpha
- License: MIT
- Python: 3.9+
- Dependencies: Zero (stdlib only)
- Tests: 124 passing (unit + integration)
- Repository: github.com/Harshit-code-tech/BLACKBOX
- PyPI: pypi.org/project/blackbox-recorder
blackbox-recorder records what your Python code actually did, especially when it failed quietly, without requiring you to prepare for failure in advance.
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 blackbox_recorder-0.4.2.tar.gz.
File metadata
- Download URL: blackbox_recorder-0.4.2.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ca4b4f9331aa66819894786d2016279722a868739dd8e87a4114d5d8cf5c006
|
|
| MD5 |
1e6d27295adc97c181a9019274653ad9
|
|
| BLAKE2b-256 |
7a845a932402a2fa3179fc28682c6fbb833f74e535099037a7685a0bf7a431f4
|
File details
Details for the file blackbox_recorder-0.4.2-py3-none-any.whl.
File metadata
- Download URL: blackbox_recorder-0.4.2-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3f35c04f9fe508b80f83409244edb9afd2a7ba660e10937fd1ea894033dbb27
|
|
| MD5 |
c18bef86c0a4e3595761d0758d931430
|
|
| BLAKE2b-256 |
76fd42c0434e379ae34d3857286a381e99e440887a7b5f84a1e444f66a049a97
|