Skip to main content

A CLI tool to visualize Python code execution locally.

Project description

⚡ PyViz Tutor

A modern, offline execution visualizer for Python. Trace your code step-by-step in a beautiful, dark-mode interface.


🚀 What is it?

PyViz Tutor is a CLI tool that works like https://pythontutor.com/ but runs entirely on your local machine.

It executes your Python script, captures the line-by-line execution flow (variables, stack, output), and generates a single, self-contained HTML file. Perfect for debugging algorithms, teaching programming concepts, or understanding complex logic with a VS Code-inspired visual interface.


✨ Features

  • 🔒 100% Offline: No data leaves your machine. Everything runs locally.
  • 🎨 Modern UI: Beautiful Dark Mode interface inspired by modern IDEs.
  • 📦 Zero-Dependency Output: Generated HTML file has all CSS/JS embedded. Share it easily.
  • Time Travel: Scrub through execution with slider or play/pause controls.
  • 🕵️ Variable Explorer: Watch local variables change state in real-time with color-coded types.
  • 🖥️ Standard Output: View print() statements exactly as they appear during execution.

📦 Installation

Install globally using pip or uv:

# Standard way
pip install pyviz-tutor

# Modern, fast way (Recommended)
uv tool install pyviz-tutor

🎮 Usage

Create a Python script (e.g., recursion.py):

def factorial(n):
    if n == 0: return 1
    return n * factorial(n-1)

print(factorial(5))

Run the visualizer:

pyviz recursion.py

Your browser will automatically open viz.html showing the trace.


🔧 How it Works

  • Tracer: Uses sys.settrace to record interpreter state at every line.
  • Serializer: Converts complex objects safely into string representations.
  • Bundler: Injects trace data into a pre-built HTML template with a reactive frontend.

🛠️ Development

Want to contribute or modify the source?

# Clone the repo
git clone https://github.com/azmatsiddique/pyviz-tutor.git
cd pyviz-tutor

# Install dependencies using uv
uv venv
uv pip install -e .

# Run tests
pyviz tests/test_script.py

📝 License

Distributed under the MIT License. See LICENSE for details.


Built with ❤️ by Azmat

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

pyviz_tutor-0.1.5.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

pyviz_tutor-0.1.5-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pyviz_tutor-0.1.5.tar.gz.

File metadata

  • Download URL: pyviz_tutor-0.1.5.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pyviz_tutor-0.1.5.tar.gz
Algorithm Hash digest
SHA256 bc9b1f7af931049f386ba016f965797d16fa785d8eacf3706bebc369d900ca72
MD5 dee7a66c86de2e221f0ee24c88f5ca6d
BLAKE2b-256 db8ea9617b891b422529f6a2c6a66a7683b512daa5ddcb7593b40424b07e8279

See more details on using hashes here.

File details

Details for the file pyviz_tutor-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyviz_tutor-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pyviz_tutor-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a5d27cb3ee482aaa1a9e111aaa9dc07263fba5070e6e58071f5505d32f800e51
MD5 1991d48af3a6bc2107a15d15a31f5716
BLAKE2b-256 eab8d2967c3f3d29189fcea32e01d7b9486e7aaf03d6d56cf3769d1e61c113d5

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