Skip to main content

"Step through code execution, inspect variables over time, capture traces, and export insights - all from Jupyter, CLI, or your IDE"

Project description

Python OS 3.8, 3.9, 3.10 PyPI version GitHub release

pydebugviz

Visual Time-Travel Debugging for Python
Trace everything. Watch everything. Export everything.


Overview

pydebugviz captures your Python function’s execution step-by-step and lets you explore it in:

  • Jupyter
  • Terminal (CLI)
  • IDEs

Now in v1.0.1:

  • DebugSession interactive navigator
  • live_watch() for real-time variable display
  • show_summary() for CLI/Jupyter-friendly overview
  • export_html() for trace visualization
  • ✅ Validation tools, safe evaluation, and large var protection

Installation

pip install pydebugviz

Feature Matrix

Feature Jupyter CLI IDE
debug()
DebugSession
show_summary()
export_html()
live_watch()
validate_trace()

Quick Start

from pydebugviz import debug, show_summary

def test():
    x = 0
    for i in range(4):
        x += i
    return x

trace = debug(test, breakpoints=["x > 3"], max_steps=100)
show_summary(trace)

Example Output:

[pydebugviz] Trace Summary: 6 steps
 - step: 0 | event: call | function: test | line_no: 3
 - step: 1 | event: line | function: test | line_no: 4
 - step: 2 | event: line | function: test | line_no: 5
 - step: 3 | event: line | function: test | line_no: 4
 - step: 4 | event: line | function: test | line_no: 5
 - step: 5 | event: return | function: test | line_no: 6

Interactive DebugSession

from pydebugviz import DebugSession

session = DebugSession(trace)
session.jump_to(3)
print(session.current())
session.show_summary()

Example Output:

{'event': 'line', 'function': 'test', 'line_no': 4, 'locals': {'x': '3', 'i': '2'}, ...}
[pydebugviz] Trace Summary: 6 steps
 - step: 0 | event: call | function: test | line_no: 3
 - step: 1 | event: line | function: test | line_no: 4
 ...

Live Watch Mode

from pydebugviz import live_watch

def my_function():
    x = 1
    for i in range(3): x += i

live_watch(my_function, watch=["x", "i"], interval=0.1)

Example Output (CLI or Jupyter):*

[Step 1] my_function:3 | x=1, i=<not defined>
[Step 2] my_function:3 | x=1, i=0
[Step 3] my_function:3 | x=1, i=1
[Step 4] my_function:3 | x=2, i=2

Export HTML

from pydebugviz import export_html

export_html(trace, filepath="trace_output.html")

Creates:
A self-contained HTML file with a table of steps, functions, line numbers, and variables.
Just open trace_output.html in your browser.


Validation + Safe Eval

from pydebugviz import validate_expressions, safe_eval

print(validate_expressions(["x > 3", "bad =="]))   # syntax check
print(safe_eval("x > 5", {"x": 7}))                # safely evaluate

Example Output:

['bad ==']
True

Trace Schema Enforcement

from pydebugviz import normalize_trace, check_trace_schema

normalized = normalize_trace(trace)
issues = check_trace_schema(normalized)
print("Schema issues:", issues)

Example Output:

Schema issues: []

License

MIT License
(c) 2025 pydebugviz contributors

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

pydebugviz-1.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

pydebugviz-1.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file pydebugviz-1.1.0.tar.gz.

File metadata

  • Download URL: pydebugviz-1.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for pydebugviz-1.1.0.tar.gz
Algorithm Hash digest
SHA256 70f6d825c217d0650bf0009bf3a4d7bdbcaaa1c88214f86f92e9a9134063bceb
MD5 a6aaa58fab59650ef8f05134b38a867f
BLAKE2b-256 76c3bd54d017aeec757a2f4b75d1d8e9894d9e29f3c0c63d85ba09ba722efa55

See more details on using hashes here.

File details

Details for the file pydebugviz-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydebugviz-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for pydebugviz-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4862cbebd8f7a6b17c694119137832237807a9a727d897dcbc3846fb6d340bf
MD5 4e9f0a43d732172937c58ada509adfdc
BLAKE2b-256 8a37e2470c54d118b78959e7dc25a76b93c13408752a0abecce41c487123a1c4

See more details on using hashes here.

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