Panopticon
Panopticon is a debugger-powered tracer for Python code to quickly visualize and explore code execution. Traces generated are Catapult compatible — available at `chrome://tracing` if you're using Chrome.
Alpha: I'm still working on adding tests, polishing the api, and cleaning up the code in general. Expect the API to change drastically as it meanders towards v1. It should still be immediately useful as a debugging tool. Please report issues if you come across bugs!
Usage
You can read a more detailed guide with several examples of simple Python programs, different interfaces to visualize them and the corresponding traces at explog.in/panopticon.
Run a command directly
python3 -m panopticon -c "print('hello')" -o print_hello.trace
Run a file
python3 -m panopticon -o file.trace file.py
In code
from panopticon import record_trace
with record_trace("print_hello.trace"):
print("Hello")
Probe a specific function
It can be tricky to control how a program is executed: using the probe decorator allows instrumenting a specific function instead.
from panopticon.probe import probe
from panopticon.trace import StreamingTrace
@probe(trace=StreamingTrace(open("probe.trace", "w")))
def myfunction():
...
Asynchronous Functions
Python supports suspending and continuing execution of a frame through generators, coroutines and asynchronous generators. Panopticon creates "flow" events to connect a single frame executing through time, making it easier to visualize what's actually happening.
You can enable/disable connections for different types of functions by choosing to enable/disable flow events in Catapult (top-right).
Changelog
0.0.4
- Reimplement probes to be more robust and avoid capturing all contents
- Support for probing functions, coroutines, generators and async generators
- Probes can now write to multiple traces
0.0.3
- Added basic support for capturing arguments in traces
- New utility to "flatten" complex or sparse traces for readability
- Improved naming behavior when
selfis modified - Extremely basic support for async probes
0.0.2
- Added a simplified record_trace API
- Added support for @probe to instrument functions and classes
0.0.1
- Initial version of Panopticon
- CLI supports running commands and files for tracing
Metadata
Release files for panopticon 0.0.4
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 | Actions |
|---|---|---|---|---|
| panopticon-0.0.4.tar.gz | 15.3 kB | Without provenance | Details for panopticon-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| panopticon-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for panopticon-0.0.4-py3-none-any.whl |
Total release size: 32.9 kB
Release files / panopticon-0.0.4.tar.gz
| Download URL | panopticon-0.0.4.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8cfa9fbcde5abf82741fb590e46bf1998be7cf21fb565c3680367a6b20becb2
|
|
BLAKE2b-256 checksum How to use checksums |
89acc2316bd12b6733ea5e0d75c6ed2bcc05f9d9874e6145fdf28b2a8fcfeb44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
|
Release files / panopticon-0.0.4-py3-none-any.whl
| Download URL | panopticon-0.0.4-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22e7e63709c6492d23a394e8787a7b19a616f31da357b8326f0be3b6584cee5d
|
|
BLAKE2b-256 checksum How to use checksums |
4b8227833eb8d3c0bbd34dc74245f477bded43d8ab13121a263eb5649b206aea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
|
Security for panopticon 0.0.4
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.