Registry / data / bigtree

bigtree

JSON →
library1.5.3pypypi✓ verified 21d ago

Bigtree is a Python library that provides a performant, flexible, and intuitive implementation for tree data structures. It supports various tree types (Tree, Binary Tree, Directed Acyclic Graph) and offers a rich API for traversal, search, modification, and export. It integrates seamlessly with Python lists, dictionaries, pandas, and polars DataFrames, making it suitable for a wide range of hierarchical data workflows. The library is actively maintained with frequent releases, currently at version 1.4.0.

pip install bigtree
INSTALL
IMPORT
SIG · BIGTREE
B
bigtree
datapythonv1.5.3
Install
6.1s avg
Import
1289ms
Disk
389MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.5.3 · 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
glibc
py 3.10
✓ —
✓ 6.1s
py 3.11
✓ —
✓ 5.85s
py 3.12
✓ —
✓ 5.95s
py 3.13
✓ —
✓ 6s
py 3.9
1/2 runs
✓ 6.5s
389MB installed
● package 389MB
Code
Verified usage

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

Node
from bigtree import Node
print_tree
from bigtree import print_tree
DAGNode
from bigtree import DAGNode
Used for Directed Acyclic Graph structures where nodes can have multiple parents.
BinaryNode
from bigtree import BinaryNode
Used for binary tree structures.

This example demonstrates how to create a basic tree using `Node` objects and print its structure to the console using `print_tree`. It also shows how to access built-in node attributes like `is_leaf` and `node_name`.

from bigtree import Node, print_tree # Create nodes root = Node("a") b = Node("b", parent=root) c = Node("c", parent=root) d = Node("d", parent=b) e = Node("e", parent=b) f = Node("f", parent=c) # Print the tree print_tree(root) # Access node attributes print(f"Node 'd' is a leaf: {d.is_leaf}") print(f"Root node name: {root.node_name}")
Debug
Known issues
gotchaNode names cannot contain the separator symbol (default '/'). While it won't immediately raise an error, it can lead to issues with certain functions like tree export/import or path-based operations.
fix
Ensure node names do not contain path separator characters (e.g., '/', '\\', or custom separators if configured).
affects: All versions
gotchaThe `get_attr` method, especially for `BaseNode`/`DAGNode`, was enhanced in v1.3.0 to support chained and nested attributes and to return a default value instead of raising an error if the attribute is not found. Code relying on an `AttributeError` for missing attributes or expecting simple attribute access might need adjustments.
fix
Review existing `get_attr` calls. If you previously handled `AttributeError` for missing attributes, consider using the `default` parameter of `get_attr` (e.g., `node.get_attr('missing_attr', None)`). Be aware of new nested attribute access capabilities.
affects: >=1.3.0
breakingVersion 1.0.0 and subsequent releases (e.g., 1.0.2) introduced significant API improvements and a plugin architecture. While core usage remains largely compatible, users with highly customized node types or those directly interacting with internal components might need to refactor their code to align with the new plugin-based structure.
fix
Consult the official `bigtree` documentation and changelog, particularly for versions 1.0.0 and 1.0.2, if you experience unexpected behavior or `AttributeError` when upgrading from pre-1.0.0 versions, especially for advanced use cases or custom node extensions.
affects: >=1.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'bigtree'
The 'bigtree' library is not installed in the current Python environment or the environment is not correctly activated.
fix
Install the bigtree library using pip: `pip install bigtree`
AttributeError: 'Node' object has no attribute 'some_missing_attribute'
Prior to bigtree v1.3.0, accessing a non-existent attribute via `node.get_attr('missing_attr')` would raise an AttributeError. In v1.3.0 and later, `get_attr` was enhanced to return `None` (or a specified default value) instead of raising an error for missing attributes. Code written for older versions might expect the AttributeError.
fix
Adjust existing `get_attr` calls to expect `None` for missing attributes or explicitly provide a `default` value, e.g., `node.get_attr('missing_attr', None)`.
ValueError: tree and other_tree must have the same sep symbol
When comparing or cloning trees using functions like `get_tree_diff` or `clone_tree`, both tree instances must have been constructed with the same separator symbol (`sep`). This error can also occur if node names contain the `sep` symbol.
fix
Ensure that the `sep` symbol is consistent across all tree objects involved in the operation. If constructing trees manually, pass the same `sep` argument to `Node` or `Tree` constructors. Also, verify that node names themselves do not contain the chosen separator character.
ValueError: intermediate node names cannot be repeated
When constructing a tree from a pandas or polars DataFrame using `dataframe_to_tree_by_relation`, if there are duplicate names for intermediate (non-leaf) nodes, bigtree cannot unambiguously form the tree structure and raises an error.
fix
Ensure that all intermediate node names in the input DataFrame are unique. If duplicate intermediate node names are expected and should be handled by creating separate branches, set the `allow_duplicates` parameter to `True` in `dataframe_to_tree_by_relation`.
Upgrade
Version history
1.5.3latest on PyPI · released Jul 16, 2026
Audit
Dependencies
pythonrequiredRequired Python version
pandasoptionalFor DataFrame integration (optional)
polarsoptionalFor Polars DataFrame integration (optional)
richoptionalFor enhanced tree printing in rich format (optional)
Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
bigtree — pip install bigtree · libregistry