Skip to main content

greater_tables

commit activity PyPI version documentation license MIT

Greater Tables produces high-quality static display tables for journal articles, books, formal reports, and printed financial statements. A pandas DataFrame (or CSV, or markdown table) goes in; a clean, typographically sound table comes out in HTML, LaTeX (via TikZ), or plain text. No sparklines, no color, no shading: just your data, rendered cleanly.

from greater_tables import GT
GT(df)

Version 6.0 is a ground-up rewrite. Between the DataFrame and the page sits a versioned, JSON-serializable table document, the intermediate representation (IR). Python owns semantics (dtypes, format inference, multi-index hierarchy, spans, break depths); each renderer owns geometry and style. Nothing in the IR names a width, a rule weight, a font, or a CSS property, so the HTML renderer, the TikZ renderer, the text oracle, and the bundled JavaScript walker all draw the same table and are conformance tested against each other.

Installation

pip install greater-tables

Requires Python 3.12+. Pin greater-tables<6 anywhere you want to stay on the frozen 5.3 engine — the import name never changes, so from greater_tables import GT works on both.

Quick look

from greater_tables import GT, Fabricator
gt = GT(Fabricator(seed=42).make(10, 's2fd', index_levels=2), caption='Demo')
gt                      # rich display in JupyterLab / Quarto (HTML)
print(gt)               # text oracle view
gt.doc                  # the IR as pydantic models
gt.tikz                 # TikZ/LaTeX source

Or the explicit API, which is the same thing without the facade:

from greater_tables import build, render_html, render_tikz, TableSpec
doc = build(df, TableSpec(caption='Demo', ratio_cols='all'))
render_html(doc)        # fragment + stylesheet
render_tikz(doc)        # table environment + tikzpicture
doc.model_dump_json()   # ship it to the browser; gt-render.js draws it

demo.html is every golden fixture rendered client-side by the walker — self-contained, no server needed.

What 6.0 changes

  • A table document, not a string. build(df, spec) → TableDoc, validated pydantic models, canonical JSON, deterministic 12-hex content hash (no time salt), JSON Schema committed at schema/ir-v1.json. Cacheable, diffable, golden-testable, and an ETag for free.
  • Four renderers, one contract. HTML, TikZ, text, and the zero-dependency JS walker (gt-render.js, shipped as package data) render from that one document; the Python HTML renderer and the walker must produce identical DOM transcripts, per fixture, enforced by the test suite.
  • The display bundle knows its target. In a notebook or Quarto HTML render you get HTML; a Quarto PDF render gets TikZ and no HTML, because pandoc would prefer the HTML and its LaTeX writer would then throw it away. Every bundle also carries text/plain, so a table degrades to a readable monospace rendering rather than to <GT object at 0x…> or to nothing.
  • Semantics stay in Python, style stays in the renderer. One document-level stylesheet generated from a RULES dict (or inlined for HTMX/email), a gt-* class vocabulary, per-table scalars as CSS custom properties.
  • No import side effects, importing the package no longer touches pandas options or warnings filters. No 50-row raise, either: max_rows truncates with a note.
  • Compat facade. GT(df, caption=..., ratio_cols=..., formatters=...) works as before and renders through the new engine, lazily and cached (5.x computed TikZ eagerly even on the HTML path). Exotic 5.x config knobs warn and are ignored.
  • Interactive grids remain the job of the sibling csv-grid project, irToGridInput(doc) hands a table to it whole. This package does not sort, filter, or virtualize, by design.

Coming from 5.x? Migrating from greater_tables 5.x is the complete map: every 5.x option, what it did, and where it went — plus the three silent default changes to watch for (formatters ints now group, show_index auto-hides, header_row defaults off).

greater_tables 5.x stays available and pinnable on PyPI forever; its source and issue archive stay at mynl/greater_tables_project.

Documentation

ReadtheDocs covers design, IR reference, migration notes, API.

Source

GitHub. The repo keeps the development codename greatest-tables; the package it publishes is greater-tables.

License

MIT.

The Name

Obviously, the name is a play on the great_tables package. I have been maintaining a set of macros called GREATools (generalized, reusable, extensible actuarial tools) in VBA and Python since the late 1990s, and call all my macro packages GREAT. The rewrite was codenamed greatest while it grew up next to its parent; the repo kept the codename, the package did not.

Layout

src/greater_tables/    ir.py (pydantic IR) · spec.py · engine/ · render/ · assets/
js/src/                gt-render.js walker (built into assets/)
tests/                 fixtures (synthetic only) + goldens (ir / text / text-ascii / tikz / transcript)
schema/                committed JSON Schema export of the IR (diff-guarded by the tests)
docs/                  Sphinx documentation
dev/                   plan docs; moved to dev/done when complete

Runtime dependencies are numpy, pandas, pydantic and PyYAML — nothing else, and the JS walker has none at all.

Status

Stable (6.0.0). All seven design steps are complete: the engine, IR, JS walker, Python HTML renderer, and TikZ renderer are conformance-tested against each other, and the first consumer (aggregate_api's SPA) renders tables client-side from the IR. ir_version 1 and the public API are now settled — additive changes only within 6.x. See dev/design.md for the full design, dev/pending.md for what is outstanding, and the CHANGELOG for the version-by-version record.

Metadata

Release files for greater-tables 7.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for greater-tables 7.0.0
File Size Uploaded
greater_tables-7.0.0.tar.gz 1.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for greater-tables 7.0.0
File Interpreter ABI Platform
greater_tables-7.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.1 MB

Release files / greater_tables-7.0.0.tar.gz

Download URL greater_tables-7.0.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
989fd6436ae45680fa6eea93347cda8aa4ace3fc72b9e4422f932019668a88e2
BLAKE2b-256 checksum
How to use checksums
48cc167933a9a5671b0f61085fb0848e40697c1a80dcf6d5aa6cbfbd05b0d8a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / greater_tables-7.0.0-py3-none-any.whl

Download URL greater_tables-7.0.0-py3-none-any.whl
Size 379.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e66c5296f551d20bf98f8a7fcf919997432e21b81bb8eeb76b2cdfd3f7fe198
BLAKE2b-256 checksum
How to use checksums
4bdcd9bae6f77985647d63f46de281602a5a38bccfe00eca446ec456a8673f66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

7.0.0 This release

2 release files

6.0.0

2 release files

5.3.0

2 release files

5.2.1

2 release files

5.2.0

2 release files

5.0.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

0.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page