python-tabulate

Pretty-print tabular data in Python with one function call and dozens of table formats.

Library
PyPI
v0.10.0
2,587 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
41 /100 Fair
Development Activity 4
Maintenance 0
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
73 /100 Good
Architecture 70
Code Quality 78
Innovation 55
Learning Curve 90

Tabulate is a small, focused Python library that turns lists of lists, dicts, NumPy arrays, and pandas DataFrames into readable, aligned plain-text tables. A single tabulate() call handles column alignment, numeric formatting, and header rendering, so developers can print clean tabular output in scripts, CLIs, and notebooks without hand-rolling padding logic.

Its standout feature is breadth of output formats: over 30 table styles ranging from plain and simple text to GitHub-flavored Markdown, reStructuredText, HTML, LaTeX, and Jira/Confluence markup, plus a suite of Unicode box-drawing grids (simple, rounded, heavy, mixed, double, fancy). This makes it equally useful for quick debugging output and for generating tables destined for documentation or reports.

Beyond the Python API, the package installs a tabulate command-line utility that reads CSV, TSV, or JSON-lines data from a file or stdin and renders it in any supported format, making it a handy piece of any shell pipeline for inspecting tabular data.

What You Get

  • A single tabulate() function that accepts lists of lists, lists of dicts, dicts of iterables, dataclasses, NumPy arrays/record arrays, and pandas DataFrames as input
  • Over 30 output formats including plain, simple, github, grid variants (simple/rounded/heavy/mixed/double/fancy), pipe, orgtbl, html, latex, rst, jira, tsv, and more
  • Automatic column alignment and numeric formatting, including decimal-point alignment and configurable float/int format strings
  • A bundled tabulate CLI that reads RSV, CSV, or JSONL data from files or stdin and prints a formatted table
  • Optional row-index columns (showindex) and support for embedding separating lines between groups of rows
  • Optional wide-character (CJK) width support via the wcwidth extra for correctly aligned multi-byte text

Common Use Cases

  • Printing debug or diagnostic tables from within a script without writing custom padding/alignment code
  • Rendering a pandas DataFrame or NumPy array as a Markdown table for a README, notebook, or generated report
  • Piping CSV or JSON-lines data through the tabulate CLI to get a readable table straight from the shell
  • Generating LaTeX or reStructuredText tables for academic papers and Sphinx documentation from tabular data
  • Formatting CLI tool output (e.g. listing resources, configs, or query results) in a consistent, readable grid

Under The Hood

Architecture

The entire library lives in a single module, tabulate/__init__.py, which declares each of the 30+ output styles as a TableFormat namedtuple (line-drawing characters, row templates, padding rules) held in a dispatch table keyed by format name, alongside DataRow/Line primitives that describe how a rendered row or separator line looks. Column width calculation, alignment inference, and numeric formatting run as internal helper passes before a rendering function walks the format table to assemble the final string. The bundled cli.py is a thin argument-parsing wrapper that reads RSV/CSV/JSONL input and calls straight into the same tabulate() core, so the CLI and the importable API share one formatting path with no duplicated logic.

Tech Stack

Pure Python (3.10+) with no required runtime dependencies; an optional wcwidth extra adds wide-character (CJK) alignment support. The package is built with the flit_core/flit_scm backend and versioned via setuptools_scm from git tags. Tests run under pytest with --doctest-modules and --doctest-glob=README.md, so the README’s own examples double as executable tests; tox/tox-uv drives the multi-version matrix and ruff handles linting.

Code Quality

The test/ directory holds a dedicated suite (output, input, API, CLI, regression, textwrapper, grapheme-cluster tests) using plain assert-based pytest tests, run across a 5-Python-version by 3-OS CI matrix with a separate lint job and Codecov coverage reporting. Naming is consistent and internals are docstring-documented, though there is no static type checker (mypy) enforced and type hints are used sparingly.

API Design The public surface is deliberately tiny — one function (tabulate()) plus two small helpers (tabulate_formats, simple_separated_format) — so getting started requires no boilerplate beyond a single import and call. Keyword arguments (headers, tablefmt, floatfmt, showindex) cover nearly every customization need without subclassing or configuration objects, and accepting lists, dicts, DataFrames, and NumPy arrays interchangeably means callers rarely need to reshape their data before formatting it.

Used by 15 apps in this directory

Python
94%
Apache 2.0

knowhere

AI Development · AI Memory · Developer Tools

3,755

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
83
Repo Health
75
Technical
66
Dependency
Built with
Python 94%
Updated 5 days ago
C++
66%
Other

Memgraph

AI Development · Databases

4,628

High-performance in-memory graph database for AI context and real-time analytics

View details
90
Repo Health
79
Technical
66
Dependency
Built with
C++ 66%
Python 18%
Updated 5 days ago
Python
73%
AGPL 3.0

OpenViking

AI Development · AI Memory · Databases

40,705

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
85
Repo Health
75
Technical
64
Dependency
Built with
Python 73%
TypeScript 12%
Rust 11%
Updated 5 days ago
Go
95%
Apache 2.0

TiDB

AI Development · Databases

40,672

AI-Native Distributed SQL Database for Agentic Workloads

View details
97
Repo Health
66
Technical
68
Dependency
Built with
Go 95%
Updated 6 days ago
C++
75%
Apache 2.0

Timeplus Proton

Analytics · Data Engineering

2,273

Single C++ binary SQL engine for real-time stream processing, ETL, and analytics on Kafka, Redpanda, and ClickHouse with sub-millisecond latency.

View details
87
Repo Health
82
Technical
68
Dependency
Built with
C++ 75%
Python 11%
Updated 2 weeks ago
Python
96%
AGPL 3.0

VideoHighlighter

Video Editors

296

Local AI desktop tool that scores, explains, and cuts the moments that matter in raw footage — scene, motion, audio, object, and action detection, fully offline via Ollama and Whisper.

View details
83
Repo Health
84
Technical
71
Dependency
Built with
Python 96%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers