treelib
A Python implementation of tree structure.
Decision gist · record as of 2026-08-14
Yes. Treelib is a mature, actively maintained library with no known vulnerabilities, minimal dependencies, and broad Python version support. It solves a straightforward problem—simple tree data structures—without bloat. Install it if you need basic tree operations and console visualization; skip it if you need advanced graph algorithms or specialized tree types (e.g., balanced trees, tries).AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later.
- Low friction install with a single lightweight dependency (six).
- Actively maintained with recent releases; last commit on 2026-08-13 and over 870 repository stars indicate ongoing support.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), which allows commercial and private use with minimal restrictions—suitable for most projects.
last release 2025-06-29 (411 days) · last repo commit 2026-08-13 · 870 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,793,127 downloads/mo, #3,552 on PyPI
Alternatives
Verify before relying
pip install treelib
from treelib import Tree
tree = Tree()
tree.create_node('Root', 'root')
tree.create_node('Child', 'child', parent='root')
print(tree)- Whether the tree implementation supports all standard tree operations (insertion, deletion, search, traversal methods) beyond basic node creation.
- Performance characteristics for large trees or deeply nested hierarchies.
- Whether visualization/rendering output formats are customizable beyond console display.
What it is and what it does
Treelib is a Python library that implements a tree data structure—a hierarchical collection of nodes where each node can have parent-child relationships. It abstracts away the complexity of manually managing node pointers and tree traversal, letting you focus on building and working with tree-shaped data. The library is designed for simplicity: you create nodes, link them together, and the tree handles the structure. It includes built-in display capabilities, likely for console output, making it useful for visualizing hierarchies during development or in terminal-based tools.
The package depends only on six, a Python 2/3 compatibility layer, keeping its footprint minimal. It supports Python 3.7 through 3.13 and is classified as production-stable. With over 1.7 million monthly downloads and a position in the top 5000 PyPI packages, it has established itself as a go-to choice for developers needing a lightweight, no-fuss tree implementation without the overhead of more specialized graph libraries.
Use it for
- Build file system or directory tree representations for explorers or navigation tools.
- Create organizational hierarchies or family trees for display and traversal.
- Implement parse trees or abstract syntax trees for simple language processing tasks.
- Display menu structures or nested configuration hierarchies in CLI applications.
- Model hierarchical data like category taxonomies or DOM-like document structures.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Treelib is a mature, actively maintained library with no known vulnerabilities, minimal dependencies, and broad Python version support. It solves a straightforward problem—simple tree data structures—without bloat. Install it if you need basic tree operations and console visualization; skip it if you need advanced graph algorithms or specialized tree types (e.g., balanced trees, tries).
Install
treelib on PyPI
Before you install
Low friction install with a single lightweight dependency (six). Actively maintained with recent releases; last commit on 2026-08-13 and over 870 repository stars indicate ongoing support.
Requires Python 3.7 or later.
License in practice
Licensed under Apache-2.0 (permissive), which allows commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install treelib
from treelib import Tree
tree = Tree()
tree.create_node('Root', 'root')
tree.create_node('Child', 'child', parent='root')
print(tree)
Verify before relying
- Whether the tree implementation supports all standard tree operations (insertion, deletion, search, traversal methods) beyond basic node creation.
- Performance characteristics for large trees or deeply nested hierarchies.
- Whether visualization/rendering output formats are customizable beyond console display.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release <4.0,>=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagesix |
| Maintenance | Actively maintained 411 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,793,127 / month, #3,552 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: treelib-1.8.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “tree data structure python”
- treelibProvides a simple tree data structure implementation for Python,…
- anytreeProvides a lightweight Python library for creating, manipulating, and…
- red-black-tree-modProvides Python implementations of red-black trees with optional…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also anytree · nutree · bigtree · treetable · asciitree · dm-tree · django-tree-queries · optree · logging-tree · apted