Skip to main content

larztable

Query and render tabular data — in one small object. Zero dependencies.

Most tools make you choose: a query/dataframe library (heavy) or a pretty-printer (no querying). larztable is both, tiny. Load rows, filter/sort/aggregate them with a fluent Django-style API, then print a clean terminal table or export to CSV/Markdown — no pandas, no tabulate.

from larztable import Table

t = Table.from_dicts([
    {"name": "Ada", "age": 36, "role": "admin"},
    {"name": "Bo",  "age": 24, "role": "user"},
    {"name": "Cy",  "age": 41, "role": "user"},
])

print(t.where(role="user").sort("age", reverse=True).select("name", "age"))
┌──────┬─────┐
│ name │ age │
├──────┼─────┤
│ Cy   │  41 │
│ Bo   │  24 │
└──────┴─────┘

Why

  • One tool for both jobs. Querying and presenting are the same object: .where(), .sort(), .select(), .limit(), .group_by(), aggregates — then print(t), t.to_csv(), t.to_markdown().
  • Expressive filters. Django-style lookups — where(age__gt=30, role="user", name__icontains="a") — plus arbitrary predicate functions.
  • Reads like data. Numbers auto-right-align in the Unicode table; CSV round-trips; Markdown for docs and PRs.
  • Zero dependencies. No pandas, no tabulate, no numpy.

Install

pip install larztable

Query

t.where(role="admin")                       # equality
t.where(age__gte=30, age__lt=40)            # gt/gte/lt/lte/ne/in/contains/...
t.where(lambda r: r["age"] % 2 == 0)        # any predicate
t.sort("age", reverse=True)
t.select("name", "age")
t.limit(10, offset=5)
t.distinct("role")

# aggregates
t.count(); t.sum("age"); t.avg("age"); t.min("age"); t.max("age")
t.group_by("role").count()                  # Table of role, count
t.group_by("role").avg("age")               # Table of role, age_avg

Every query returns a new Table (the original is untouched), so chains are safe.

Load & export

Table.from_csv("data.csv")
Table.from_csv_string("name,age\nAda,36\n")
Table.from_dicts([...])
Table.from_rows([["Ada", 36]], columns=["name", "age"])

t.to_csv("out.csv"); t.to_csv()             # string
t.to_markdown()
t.to_dicts(); t.to_rows()
print(t)                                    # pretty terminal table

Tests

python -m unittest discover -s tests -v   # 27 tests, zero deps

The Larz stack

Pure-Python, zero-dependency building blocks: larz · larzchain · larzmoney · larzcrypt · larzdb · larzagent · larzchart · larzmark · larztask · larzvault · larzvm · larzcache · larzvalidate · larzid · larzrpc · larzstate · larzhttp · larzconf · larzcron · larzlimit · larzlog · larzcli · larzretry · larztime · larzpdf · larzpack · larztemplate · larzcolor · larztable

License

MIT © larz-scripter

Metadata

Release files for larztable 0.1.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 larztable 0.1.0
File Size Uploaded Provenance
larztable-0.1.0.tar.gz 7.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for larztable 0.1.0
File Interpreter ABI Platform
larztable-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / larztable-0.1.0.tar.gz

Download URL larztable-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
231d25390dec26b3b5bc917f15d05189b62f78bfe1fc7bc80cb43b366faaa0f8
BLAKE2b-256 checksum
How to use checksums
3f041afcc90e20335408af2e179ca398a96e20bdd9e50a35a3ad0b1dada9ed18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / larztable-0.1.0-py3-none-any.whl

Download URL larztable-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73a74b7ce655bf2f8533c93f12d119804baedaf36bbd32983cb14942f881c6fd
BLAKE2b-256 checksum
How to use checksums
4a69b1927be8046dc366ca21f71814b6696a05a16d0ab1544632a550ecf8a248
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for larztable 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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