Skip to main content

csvledger

Long-form CSV tables that merge idempotently: a git-friendly history store with no dependencies.

You collect numbers on a schedule (traffic, downloads, prices), each run sees an overlapping window, and you want one growing history in plain files: re-runs harmless, the order of runs irrelevant, small diffs, past years never rewritten. csvledger is that store.

from csvledger import TableSpec, Files, write_rows, read_table

views = TableSpec(
    "views", ("date", "repo", "count"),
    key=("date", "repo"), merge="max", int_columns=("count",), time_column="date",
)
store = Files("history")                      # or any MutableMapping[str, str]
write_rows(store, views, [{"date": "2026-01-01", "repo": "a/b", "count": 3}])
write_rows(store, views, [{"date": "2026-01-01", "repo": "a/b", "count": 2}])  # no change
read_table(store, views)   # [{'date': '2026-01-01', 'repo': 'a/b', 'count': 3}]

This writes history/views/2026.csv, sorted by date, so each run appends at the end of the current year's file.

Merge policies

merge= per key for
max integer fields keep the larger value daily counts seen by overlapping windows (a partial day only grows)
replace_group rows of a group (e.g. one repo, one fetch date) replace that group's earlier rows top-N snapshots
change_only a row is kept only when its values differ from the previous row of its entity (key = entity + one date column) slowly changing values (stars, versions)
upsert the new row wins current metadata

All four are idempotent: merging the same rows again changes nothing.

The store

Any MutableMapping[str, str] (relative path to text). Files(root) is a folder with atomic writes; a dol store puts the same tables in S3 or a database. write_manifest(store, tables, **extra) writes a manifest.json listing every table's files and columns, so a static dashboard can discover the data in one request.

Used by ghtraffic (GitHub traffic) and pkgreach (package downloads), where it was extracted from.

Metadata

Release files for csvledger 0.0.2

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

Source distribution (sdist)

Source distribution for csvledger 0.0.2
File Size Uploaded Provenance Actions
csvledger-0.0.2.tar.gz 8.5 kB Without provenance Details for csvledger-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 15.6 kB

Release files / csvledger-0.0.2.tar.gz

Download URL csvledger-0.0.2.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b2b18fa0899b1f07c69dc104a04fd8c9c64231cf654aab264adeae572c4267b7
BLAKE2b-256 checksum
How to use checksums
f3f1f15ca9b1675342b6099c176b5c1faa5c6c4afa2939f8f920ba2e0aeb31d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / csvledger-0.0.2-py3-none-any.whl

Download URL csvledger-0.0.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66bb7feb17fd08ebcbe851f3e51f749f64280042e83cc4b39688681b72300dcb
BLAKE2b-256 checksum
How to use checksums
4ddafe1399c5a3caae06cc0ccf1c4478ff1fff5fc457653ff1e2542550218070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for csvledger 0.0.2

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.0.2 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