Skip to main content

Panopticon

License: MIT Code style: black Alpha

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!

Sample trace with async functions

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 Catpult (top-right).

Changelog

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panopticon-0.0.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

panopticon-0.0.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file panopticon-0.0.2.tar.gz.

File metadata

  • Download URL: panopticon-0.0.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for panopticon-0.0.2.tar.gz
Algorithm Hash digest
SHA256 57c53ee5510a162e64be9c815c22ddd6f5b1e638f322598f6a71413699d42057
MD5 966f908d834f7f0564a7b00552d140a7
BLAKE2b-256 e0ee46af24499a66c41df75a12ad0d52222d5e221824c33784a0b842b93e1cb4

See more details on using hashes here.

File details

Details for the file panopticon-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: panopticon-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for panopticon-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 269e861f2bb14c2361cb568e766f24e19408b321997c7d682bb1c4609d6bb037
MD5 1dffeca9e508f565f4d5f30e9fcfe5f4
BLAKE2b-256 d4dbd97457609693cffef2131b37979e4d27c46f6d270a97c8d75a9cec096659

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.4

2 files

0.0.3

2 files

This release

0.0.2 This release

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page