SnakeViz

An in-browser viewer for Python cProfile data with interactive sunburst and icicle diagrams.

Tool
PyPI
v2.2.2
2,568stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
39/100Needs Attention
Development Activity4
Maintenance0
Community52
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture78
Code Quality78
Innovation76
Learning Curve88

SnakeViz is a browser-based visualization tool for Python profiling data. You point it at a cProfile/pstats output file and it launches a local web application that renders the profile as an interactive sunburst or icicle diagram, letting you drill into call hierarchies and see exactly where your program spends its time.

Installed from PyPI, SnakeViz is run from the command line (snakeviz program.prof) or directly inside Jupyter/IPython via its %snakeviz magic. Because it visualizes the standard library’s profile format, it works with any profiler that emits pstats data, making it a common companion to cProfile for understanding performance hotspots without squinting at text tables.

What You Get

  • A CLI (snakeviz) that opens any cProfile/pstats file in the browser
  • Interactive sunburst and icicle visualizations of the call graph
  • A sortable function statistics table alongside the diagram
  • Click-to-drill navigation that re-roots the view on any frame
  • An IPython/Jupyter %snakeviz magic for profiling cells inline

Common Use Cases

  • Visually exploring cProfile output to find performance hotspots
  • Profiling a script and inspecting the call hierarchy interactively
  • Analyzing where time is spent inside a Jupyter notebook cell
  • Sharing an intuitive view of a profile with teammates unfamiliar with pstats

Under The Hood

Architecture - The snakeviz package is a small Tornado web application: cli.py/__main__.py provide the command entry point, main.py serves routes and a stats.py module converts a pstats file into the JSON tree the frontend consumes. templates/ and static/ hold the D3-driven sunburst/icicle visualization, and ipymagic.py wires up the Jupyter %snakeviz magic.

Tech Stack - Python (Tornado) on the server side generating JSON from the standard-library pstats format, with an HTML/CSS/JavaScript (D3) frontend for the interactive diagrams. Packaged via pyproject.toml with bundled static assets.

Code Quality - The codebase is compact and focused with a tests/ suite and CI workflow, though the project is in low-maintenance mode with little recent activity. The stats-transformation and server layers are cleanly separated from the visualization assets.

API Design - Usage is essentially one command (snakeviz file.prof) or one magic (%snakeviz), which makes the developer experience very approachable; the interface is the browser UI rather than a code API, and getting a visualization takes a single step from any pstats file.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search