Skip to main content

A CLI tool to visualize Python code execution locally.

Project description

⚡ PyViz TutorA modern, offline execution visualizer for Python. Trace your code step-by-step in a beautiful, dark-mode interface.Report Bug · Request Feature
🚀 What is it?PyViz Tutor is a CLI tool that works like "Python Tutor" 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. You can debug algorithms, teach programming concepts, or simply understand complex logic with a VS Code-inspired visual interface.✨ Features🔒 100% Offline: No data leaves your machine. Everything runs locally.🎨 Modern UI: A beautiful Dark Mode interface inspired by modern IDEs.📦 Zero-Dependency Output: The generated HTML file has all CSS/JS embedded. You can email it to a student or friend, and it just works.⏪ Time Travel: Scrub through your code execution with a slider or play/pause controls.🕵️ Variable Explorer: See local variables change state in real-time with color-coded types.🖥️ Standard Output: View print() statements exactly as they appear during execution.📦 InstallationInstall it globally using pip or uv:# The standard way pip install pyviz-tutor

The modern, fast way (Recommended)

uv tool install pyviz-tutor 🎮 UsageCreate 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 That's it! Your browser will automatically open viz.html showing the trace.🔧 How it WorksPyViz uses Python's advanced sys.settrace hook to record the state of the interpreter at every line of code.Tracer: The Python engine executes your code and records a "snapshot" of every step (line number, local variables, stdout).Serializer: It handles complex objects safely (converting non-serializable objects like sockets or file handles into string representations).Bundler: It injects this trace data directly into a pre-built HTML template containing a Vue-like reactive frontend.🛠️ DevelopmentIf you want to contribute or modify the source:# Clone the repo git clone https://github.com/yourusername/pyviz-tutor.git cd pyviz-tutor

Install dependencies using uv

uv venv uv pip install -e .

Run tests

pyviz tests/test_script.py 📝 LicenseDistributed under the MIT License. See LICENSE for more information.

Built with ❤️ by [Your Name]

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.1.tar.gz (8.2 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.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyviz_tutor-0.1.1.tar.gz
  • Upload date:
  • Size: 8.2 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.1.tar.gz
Algorithm Hash digest
SHA256 6d76b5e60c7c579f7c550333806ad6bbccf45080be8ceaeeef0dfc48651173ec
MD5 9f2aa4b4893c7c6be4c354ac169345fc
BLAKE2b-256 00da2ce3820bc85db094ff28344e064656e37f3c42069421298f6bdc392ec22a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyviz_tutor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 324a175815a7e0d33d3b3517c6ffa34d57bf76602cad9d9028c81f20455ba877
MD5 e9e206ea711cd52f42cb468438c9fb07
BLAKE2b-256 b436f12d795a94a5f75d0787996025d9ff90a907cb009583c0d18372379e9f71

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