A small Python execution visualizer built with:
FastAPIbackend- Docker sandbox runner for executing user code
Next.jsfrontend with editor, stepper, call stack, and heap views
- Run Python code and trace execution step-by-step
- View current line in source
- Inspect call stack and function frames
- Inspect heap objects with reference-based serialization (Python Tutor-style)
- Sandboxed execution in Docker with basic hardening (
--network none, memory/CPU limits, read-only FS, PID limits)
backend/main.py- FastAPI API (POST /trace)backend/sandbox/runner.py- Python tracer + serializer executed inside Dockerbackend/sandbox/Dockerfile- sandbox imagefrontend/- Next.js app (editor + visualizer UI)
docker build -t python-visualizer-runner backend/sandboxuvicorn backend.main:app --reload --host 127.0.0.1 --port 8000cd frontend
npm install
npm run devOpen http://localhost:3000
- This is a side project and intended for local use.
- User code is executed with
exec()inside a Docker container (not directly in the FastAPI process). - If you expose the backend publicly, add stronger production hardening and authentication/rate limits.
