--- id: treetable version: "0.2.6" license: Unlicense license license_treatment: permissive maintenance: aging --- # treetable — Helper to pretty print an ascii table with a tree-like structure License: permissive · Maintenance: aging · Downloads: 311.3K/mo ## 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 above — 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 pip install treetable uv add treetable 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_current - Install friction: low - Maintenance: aging - Downloads: 311.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags ascii table formatting, nested hierarchical tables, tree-structured data display, pretty print tables, column grouping and alignment, terminal table rendering, formatted data output, cli-output, data-formatting [View on SkillFed](https://skillfed.io/packages/treetable) · [View on PyPI](https://pypi.org/project/treetable/)