AlgoTree

A powerful, modern tree manipulation library for Python with an immutable-by-default API.

Features

Quick Start

from AlgoTree import Node, parse_tree, pretty_tree

# Create trees with constructor
tree = Node("root",
    Node("src", Node("main.py"), Node("utils.py")),
    Node("docs", Node("README.md"))
)

# Or parse from text
tree = parse_tree("""
root
├── src
│   ├── main.py
│   └── utils.py
└── docs
    └── README.md
""")

# Visualize
print(pretty_tree(tree))

# Transform (immutably)
filtered = tree.filter(lambda n: not n.name.startswith("."))
with_attrs = tree.map(lambda n: n.with_attrs(visited=True))

Installation

pip install AlgoTree

What’s New in v2.0

License

MIT License - see LICENSE for details.