A Rich + Typer powered tree viewer that summarizes directories when they get busy.
Project description
ttree 🍵-🌳
ttree is a Rich + Typer powered alternative to tree that keeps directory browsing
readable, summarizing noisy folders, colorizing output, and optionally hiding dotfiles.
Features
- Rich renders a hierarchical tree with coloring for directories, files, and summaries.
- Crowded directories are collapsed: file clusters become summaries like
5 py, 3 md filesand subdirectories collapse toN directories. - Dotfiles stay hidden unless you opt in with
-a/--all. - A live progress spinner appears when scanning large trees on a TTY.
-V/--versionprints the installed version for quick diagnostics.
Installation
Requires Python 3.11+.
From PyPI:
pip install tea-tree
For local development, install via uv:
uv sync --extra dev
or use pip install -e .[dev]. After installation the ttree console script is available
on your PATH.
Usage
ttree [DIRECTORY] [OPTIONS]
Common examples:
# summarize files once there are more than 2 siblings
ttree ~/Developer -m 2
# include dotfiles and show fewer subdirectories before collapsing
ttree src -a -d 5
# print version information immediately
ttree -V
During development, uv run ttree -- --help or python -m ttree behave the same without
installing the entry point.
Key options
DIRECTORY(default.): root folder to inspect.-m, --max-files-to-list: maximum files to display individually before summarizing. Set to0to always show summaries.-d, --max-dirs-to-list: maximum subdirectories to list before usingN directories. Set to0to only emit counts.-a, --all: include entries starting with..
Example Output
$ ttree demo -m 2 -d 3
demo
├── api
│ ├── handlers
│ └── models
├── docs
│ └── 3 directories
├── scripts
│ └── 4 py, 1 sh files
└── tests
├── unit
└── 5 directories
The actual CLI uses color and dimmed summaries via Rich; the example above shows the structure you can expect.
Development
- CLI implementation:
src/ttree/cli.py; helpers live nearby.main.pyis a lightweight wrapper for executing the app without installation. - Run tests via
pytest. Fixtures cover directory summaries, dotfile behavior, permission errors, and Typer command invocations. - Build distributables with
uv build; the project uses theuv_buildbackend.
Contributions are welcome—tune the thresholds or output styles in src/ttree/cli.py and
update the tests to keep coverage high.
Publishing to PyPI
- Bump
versioninpyproject.tomland update the changelog/README as needed. - Install dependencies (
uv sync --extra dev) and runpytest. - Build artifacts:
uv build(createsdist/tea_tree-<version>.whland.tar.gz). - Publish with a PyPI token:
UV_PYPI_TOKEN=... uv publish --token "$UV_PYPI_TOKEN".
The published distribution name is tea-tree, while the installed CLI remains ttree.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tea_tree-0.1.2.tar.gz.
File metadata
- Download URL: tea_tree-0.1.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d67a2df4575070ed8ad9949b559a444bccf88dcdd826b9efecfb179c87f4c8dc
|
|
| MD5 |
568bc32b06ca1f3234479b2651c005c3
|
|
| BLAKE2b-256 |
139fb08b8c311fecba5cc028d98ef83badf7fa1a12ccf780c9e7f3c43cb37862
|
File details
Details for the file tea_tree-0.1.2-py3-none-any.whl.
File metadata
- Download URL: tea_tree-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6daf78d22fdee77f063105f271bdf37923308f1e834b5b199e5fcb5cf715503b
|
|
| MD5 |
4e431ff531707a7d87de373dafe0095c
|
|
| BLAKE2b-256 |
840b667a75b18afb719050cd39d227f719086a0ed716f4cf3a51e9580f0f9158
|