skillfed

treetable

Helper to pretty print an ascii table with a tree-like structure

treetable v0.2.6 311.3K downloads/30d#7,737 on PyPI20
Permissive license Unlicense license AGING released

What it is and what it does

treetable is a utility for rendering hierarchical data as formatted ASCII tables suitable for terminal output. It takes nested dictionaries and a tree-like schema definition to produce multi-level column headers with customizable separators, alignment, text wrapping, and ANSI color support. The schema is built from `table`, `group`, and `leaf` node functions that define the structure, display names, and formatting rules (alignment, number formats, column shortening) for each column or column group.

The package is useful when you need to display complex, multi-dimensional data in a human-readable tabular format—for instance, experiment results with grouped metrics, hierarchical data exports, or formatted reports in CLI applications. It handles the layout and alignment logic automatically, letting you focus on the data structure and presentation preferences rather than manual spacing and formatting.

Use it for:

  • Display machine learning experiment results with grouped train/test metrics and per-model statistics.
  • Format hierarchical data exports (e.g., nested JSON or tree-structured database queries) as readable terminal tables.
  • Generate formatted CLI reports with multi-level column headers and custom alignment for different data types.
  • Pretty-print nested configuration or inventory data with automatic column width and alignment management.
  • Create colored terminal output for monitoring dashboards or log analysis tools with grouped metrics.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Renders nested data structures as formatted ASCII tables with hierarchical column grouping and customizable alignment, wrapping, and ANSI color support.

Yes, if you need to render hierarchical tabular data in the terminal. The package is lightweight, dependency-free, and permissively licensed. The aging maintenance status (346 days since last release) is a minor concern for a stable utility, but the lack of active development means no recent bug fixes or feature additions—suitable for stable use cases, less so if you anticipate needing ongoing support.

Install

treetable on PyPI

pip

pip install treetable

uv

uv add treetable

poetry

poetry add treetable

Installing treetable

Before you install

Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last release was 346 days ago, though the repository remains active and the package supports current Python versions.

License in practice

Distributed under the Unlicense, a permissive public-domain dedication. You may use, modify, and distribute the package with no restrictions or attribution requirements.

Quickstart

pip install treetable

from treetable import table, group, leaf, treetable

mytable = table([
    group('info', [leaf('name'), leaf('index')]),
    group('metrics', [leaf('speed', '.0f'), leaf('accuracy', '.1%')])
])

lines = [
    {'info': {'name': 'bob', 'index': 4}, 'metrics': {'speed': 200, 'accuracy': 0.21}},
    {'info': {'name': 'alice', 'index': 2}, 'metrics': {'speed': 67, 'accuracy': 0.45}}
]

print(treetable(lines, mytable))

Requires Python 3.6 or later.

Verify before relying

  • Whether the package handles deeply nested hierarchies (beyond 3 levels) without performance degradation.
  • How the package behaves with very large datasets or extremely wide tables.
  • Whether ANSI color codes work correctly on all terminal emulators and Windows console environments.

Package facts

License Unlicense license (permissive)
Python support supports the current Python release (>=3.6.0)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 346 days since the last release
Last repo commit
First released
Downloads 311,282/month — #7,737 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: treetable-0.2.6-py3-none-any.whl

Topic :: Text Processing

Tags

ascii table formattingnested hierarchical tablestree-structured data displaypretty print tablescolumn grouping and alignmentterminal table renderingformatted data output
cli-outputdata-formatting

More Text Processing packages