Registry / web-framework / ipytree

ipytree

JSON →
library0.2.2pypypi✓ verified 84d ago

ipytree is a Python library that provides an interactive Tree Widget for Jupyter environments, built using the Jupyter-widgets protocol and jsTree. It offers an easy-to-use interface to visualize and manipulate hierarchical data structures directly within Jupyter Notebooks and JupyterLab, and can be seamlessly integrated with other `ipywidgets` components.

pip install ipytree
INSTALL
IMPORT
SIG · IPYTREE
I
ipytree
web-frameworkpythonv0.2.2
Install
5.1s avg
Import
1828ms
Disk
80MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 1.939s · 88.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.1s · import 1.718s · 89MB
80MB installed
● package 80MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tree
from ipytree import Tree
Node
from ipytree import Node

This example demonstrates how to create a basic hierarchical tree structure using `ipytree.Tree` and `ipytree.Node` objects, and then display it in a Jupyter environment. Nodes can be added and nested to form complex structures.

from ipytree import Tree, Node # Create a root node root_node = Node('Root') # Add child nodes child1 = Node('Child 1') child2 = Node('Child 2') root_node.add_node(child1) root_node.add_node(child2) # Add a nested node sub_child = Node('Sub Child') child1.add_node(sub_child) # Create the tree widget and add the root node tree = Tree(nodes=[root_node]) # Display the tree tree
Debug
Known issues
breakingUsers of `ipywidgets` version 8.0.5 may encounter issues with `ipytree` functionality due to changes in how widgets handle structured cloning (`structuredClone`). This affected default serializers.
fix
Upgrade `ipywidgets` to 8.0.6 or newer, which includes a fix for the `structuredClone` issue. Alternatively, downgrade `ipywidgets` to 8.0.4 or earlier.
affects: ipytree 0.2.2 with ipywidgets 8.0.5
gotchaOlder JupyterLab versions (<=2) and classic Jupyter Notebook (version 5.2 or below) required explicit manual installation and enabling of Jupyter extensions for `ipytree` to display correctly.
fix
For JupyterLab <=2, run `jupyter labextension install @jupyter-widgets/jupyterlab-manager ipytree`. For Jupyter Notebook <=5.2, run `jupyter nbextension enable --py --sys-prefix ipytree`. Modern JupyterLab 3+ and `ipywidgets >= 7.6.0` generally handle this automatically.
affects: <= JupyterLab 2, <= Jupyter Notebook 5.2
gotchaWhen running `ipytree` in environments like VS Code's Jupyter integration or certain cloud notebooks (e.g., EMR), users may encounter 'Error displaying widget' if the frontend extension isn't correctly loaded or compatible.
fix
Ensure your JupyterLab/Notebook environment is up-to-date and that `ipywidgets` and `ipytree` are installed correctly. In some cases, a `jupyter lab build` might be necessary if manual extension management was performed, though typically `pip install` or `conda install` should suffice for modern setups. Consult the specific environment's documentation for widget compatibility.
affects: All versions
Errors
Common errors & fixes
Error displaying widget
The `ipytree` JupyterLab or Notebook extension is not properly installed or enabled, or there's a compatibility issue with the Jupyter frontend.
fix
For JupyterLab 3+ and `ipywidgets >= 7.6.0`, reinstall `ipytree` to trigger automatic extension registration. For older environments, manually install/enable the extensions as described in the warnings. Ensure Python kernel is restarted.
Uncaught DOMException: Failed to execute 'structuredClone' on 'Window': # could not be cloned.
This error specifically occurred with `ipywidgets` version 8.0.5, which introduced a change related to `structuredClone` that affected `ipytree` and other custom widgets.
fix
Update `ipywidgets` to version 8.0.6 or newer, or downgrade it to 8.0.4 or earlier.
Upgrade
Version history
0.2.2latest on PyPI · released Aug 23, 2022
Audit
Dependencies
ipywidgetsrequiredCore dependency for Jupyter interactive widgets.
jupyterlabrequiredRequired for displaying the widget in JupyterLab, ideally version 3.0+ for simplified extension management.
Agent activity
4 hits · last 30 days
node
4
Resources
ipytree — pip install ipytree · libregistry