Skip to main content

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 files and subdirectories collapse to N directories.
  • Dotfiles stay hidden unless you opt in with -a/--all.
  • A live progress spinner appears when scanning large trees on a TTY.
  • -V/--version prints 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 to 0 to always show summaries.
  • -d, --max-dirs-to-list: maximum subdirectories to list before using N directories. Set to 0 to 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.py is 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 the uv_build backend.

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

  1. Bump version in pyproject.toml and update the changelog/README as needed.
  2. Install dependencies (uv sync --extra dev) and run pytest.
  3. Build artifacts: uv build (creates dist/tea_tree-<version>.whl and .tar.gz).
  4. 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

tea_tree-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tea_tree-0.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file tea_tree-0.1.1.tar.gz.

File metadata

  • Download URL: tea_tree-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for tea_tree-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c52c4daf94ca901a88da21db3e09cf6646866d06076f7b7d93924bf7d91f33e4
MD5 1c6ab4b0ee086e297478bdd216b04f24
BLAKE2b-256 491faf300c4e46dfcdf15313795dc071632599889242f4f44e98e98b671f2e37

See more details on using hashes here.

File details

Details for the file tea_tree-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tea_tree-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for tea_tree-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 953673ff24ba001172aee19ff4ee8dc4654b6c3947ffd6f8571916578b3a43e9
MD5 6f7cac810bc92bacad17ba18ce3d1c3f
BLAKE2b-256 abc20ab74b10a3b37626a814ef30063f2ff105c4ca56e05773dce18a152de1cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page