treescope
Treescope: An interactive HTML pretty-printer for ML research in IPython notebooks.
What it is and what it does
Treescope is a specialized pretty-printer for machine learning research that replaces IPython's default object renderer with an interactive HTML visualization. Instead of flat text output, it renders objects as expandable trees where you can click to drill into nested structures, automatically visualizes multi-dimensional arrays with shape and value distribution information, and adds features like copy-path buttons and type inspection mode. It was originally built for the Penzai neural network library but also works with other frameworks and plain numpy code.
The package depends only on numpy and installs as a pure Python wheel, making it lightweight and easy to add to existing notebooks. It's designed as a drop-in replacement—you can either call treescope.show() on specific objects or register it globally to replace the notebook's default renderer. Configuration options let you control verbosity and abbreviation depth, and the package is actively maintained with no known security vulnerabilities.
Use it for:
- Inspecting large neural network model structures in notebooks to understand layer hierarchies and parameter sharing.
- Visualizing high-dimensional tensor shapes and value distributions without leaving the notebook.
- Debugging complex nested data structures by expanding only the parts you care about.
- Quickly copying qualified paths to specific fields in rendered objects for use in code.
- Rendering models from multiple frameworks with consistent interactive visualization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Treescope is an interactive HTML pretty-printer and tensor visualizer for IPython notebooks that renders complex objects with expandable trees, faceted array visualizations, and copy-path buttons.
Yes. Treescope is actively maintained, has no security issues, installs with minimal friction, and solves a real pain point for ML researchers working in notebooks. The permissive license poses no restrictions. Install it if you spend time inspecting complex objects or tensors in IPython notebooks.
Install
treescope on PyPI
pip
pip install treescopeuv
uv add treescopepoetry
poetry add treescopeInstalling treescope
Before you install
Low friction: pure Python wheel with only numpy as a runtime dependency. Actively maintained with recent commits and no known vulnerabilities.
License in practice
Permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install treescope
import treescope
treescope.basic_interactive_setup(autovisualize_arrays=True)
# Then use treescope.show(object) or treescope.register_as_default()
Requires Python 3.10 or later and an IPython notebook environment.
Verify before relying
- Whether treescope works with non-notebook Python environments or only in interactive notebooks.
- Performance characteristics when rendering very large or deeply nested objects.
- Compatibility with specific versions of Jupyter or Colab beyond the general IPython requirement.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 371 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,006,234/month — #2,790 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: treescope-0.1.10-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
ipywidgetsipywidgets provides interactive HTML widgets…
permissive · top 1,000 on PyPI
asciitreeRenders tree data structures as formatted ASCII…
permissive · top 5,000 on PyPI
ipytreeipytree provides a tree-structure widget for…
permissive · top 15,000 on PyPI
johnnydepJohnnydep displays the full dependency tree of…
permissive · top 15,000 on PyPI
prettyprinterSyntax-highlighted, declarative pretty printer…
permissive · top 5,000 on PyPI
dtreevizdtreeviz renders decision trees from…
permissive · top 15,000 on PyPI
yellowbrickYellowbrick provides scikit-learn-integrated…
permissive · top 15,000 on PyPI
gdbmongoGdbmongo provides GDB pretty printers and…
permissive · top 5,000 on PyPI
wadler-lindigFormats Python objects for readable output…
permissive · top 5,000 on PyPI
pprintpppprintpp is a drop-in replacement for Python's…
permissive · top 5,000 on PyPI