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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greater_tables-6.0.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

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

greater_tables-6.0.0-py3-none-any.whl (360.9 kB view details)

Uploaded Python 3

File details

Details for the file greater_tables-6.0.0.tar.gz.

File metadata

  • Download URL: greater_tables-6.0.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for greater_tables-6.0.0.tar.gz
Algorithm Hash digest
SHA256 b70ae3f6f12211d5423260106d2afe847bf29959e8648c4f7c2d4a9f15c0d0f1
MD5 65f2d50bb91c58a19e4db7ce9a1aae79
BLAKE2b-256 15013a268be5bb7a1d3d564647c14f000b0818d9b5d8e0d252effc12f4778905

See more details on using hashes here.

File details

Details for the file greater_tables-6.0.0-py3-none-any.whl.

File metadata

  • Download URL: greater_tables-6.0.0-py3-none-any.whl
  • Upload date:
  • Size: 360.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for greater_tables-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2159a05bba635e728a0e61b6c9e2f30acb42c651f00da01e9b5d5caff57d78a
MD5 ca012f3d3d9036c41a2ed2dbf0a6c685
BLAKE2b-256 acde2e77f9cd75c71cad5e3912a01a49beefed34ae06ddc94f52f5c2e6a41f6c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

6.0.0 This release

2 files

5.3.0

2 files

5.2.1

2 files

5.2.0

2 files

5.0.0

2 files

3.3.0

2 files

3.2.0

2 files

1.1.1

2 files

1.1.0

2 files

0.6.0

2 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