nutree
A Python library for tree data structures with an intuitive, yet powerful, API.
What it is and what it does
Nutree is a tree data structure library that lets you build and work with hierarchical node structures in Python. It supports both simple string nodes and arbitrary Python objects, with a navigation API for accessing, searching, and iterating through trees. The library handles common tree operations like pattern-based search, node filtering, and traversal in multiple ways.
The package is designed for unobtrusive integration—you can wrap existing objects as tree nodes without modification. It offers serialization to JSON (with compression support), export to graph formats like DOT and Mermaid diagrams, RDF conversion, and tree comparison with patch generation. All code is fully type-annotated and supports typed child nodes.
Use it for:
- Build hierarchical file system or organizational structure representations in memory
- Search and filter tree nodes by name pattern, object reference, or ID across large hierarchies
- Serialize tree structures to JSON for storage or API transmission, with optional compression
- Generate visual diagrams of tree structures using Graphviz or Mermaid for documentation
- Compare two trees and compute structural differences or patches for version control
- Wrap arbitrary Python objects as tree nodes without modifying the original classes
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Nutree provides a Python library for creating, navigating, and manipulating tree data structures with support for searching, serialization, and visualization.
Yes. Nutree is a well-maintained, actively developed library with no known vulnerabilities, permissive MIT licensing, and low installation friction. It's suitable for any Python project needing tree data structures—from simple hierarchies to complex object graphs—with a mature API and comprehensive feature set.
Install
nutree on PyPI
pip
pip install nutreeuv
uv add nutreepoetry
poetry add nutreeInstalling nutree
Before you install
Low friction installation with a single pure-Python wheel dependency on typing_extensions. The package is actively maintained with a recent release on 2025-02-09 and an active repository.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and commercial projects.
Quickstart
from nutree import Tree, Node
tree = Tree("Root")
node = tree.add("Child")
node.add("Grandchild")
tree.print()
Verify before relying
- Whether the package supports Python versions older than 3.9 despite classifiers listing 3.9 as minimum
- Performance characteristics and scalability limits for very large trees
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing_extensions |
| Maintenance | actively maintained — 551 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,026,327/month — #4,479 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nutree-1.1.0-py3-none-any.whl
Keywords: tree, data structure, digraph, graph, nodes, hierarchy, treelib
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
bigtreeBigtree provides tree, binary tree, and…
permissive · top 15,000 on PyPI
django-modeltreeProvides a simplified interface for navigating…
permissive · top 15,000 on PyPI
treelibProvides a simple tree data structure…
permissive · top 5,000 on PyPI
kdtreeConstructs, modifies, and searches…
permissive · top 15,000 on PyPI
anytreeProvides a lightweight Python library for…
unclear · top 5,000 on PyPI
pathablePathable provides path-like objects for…
permissive · top 1,000 on PyPI
optreeOpTree provides optimized utilities for…
permissive · top 5,000 on PyPI
graph-retrieverCombines vector similarity search with graph…
permissive · top 15,000 on PyPI
accumulation-treeImplements a red/black tree that stores partial…
permissive · top 15,000 on PyPI
ete3ETE3 reconstructs, manipulates, analyzes, and…
copyleft · top 15,000 on PyPI