skillfed

nutree

A Python library for tree data structures with an intuitive, yet powerful, API.

nutree v1.1.0 1.0M downloads/30d#4,479 on PyPI55
Permissive license MIT Active released

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 nutree

uv

uv add nutree

poetry

poetry add nutree

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

tree data structure libraryhierarchical node navigationtree traversal and searchserialize tree to jsontree visualization graphvizpython tree libraryarbitrary object tree nodes
data-structurestree-algorithmsgraph-visualization

More Python Modules packages