sourceledger
Build a dataset from published sources and keep a record of the downloads behind it.
sourceledger is a Python library and command for researchers who combine other people's
CSV, JSON, Excel or binary files. List the sources and reuse terms in sources.toml, then:
fetchdownloads the files and records their URLs, dates and SHA-256 checksums.buildwrites tables with provenance columns, or copies file sources unchanged.validatechecks the outputs against the downloads and the manifest.releasewrites the folder to publish, without the sources whose terms forbid it, and checks it.
Each table row identifies its download. A datapackage.json describes the outputs.
The documentation website follows a source through a publisher's revision.
Install
uv tool install sourceledger
For a Python project that imports the library, use uv add sourceledger instead.
Use sourceledger[xlsx] in either command to read Excel files, sourceledger[parquet]
to write Parquet outputs, or sourceledger[release] to check RO-Crate and Croissant metadata.
Python 3.12 or later is required; Linux, macOS and Windows are supported.
This README follows main, including unreleased features.
Quick start
Write a sources.toml in the project root (sourceledger init writes a starter):
[[source]]
id = "co2"
status = "implemented"
url = "https://raw.githubusercontent.com/datasets/co2-ppm/main/data/co2-annmean-mlo.csv"
vintage = "main branch, unversioned"
terms = "ODC-PDDL-1.0 (datasets/co2-ppm package; original data from NOAA GML)"
terms_url = "https://opendatacommons.org/licenses/pddl/"
license = "PDDL-1.0"
redistribute = true
Then run the stages from that directory:
sourceledger fetch
sourceledger build
sourceledger validate
sourceledger fetch --help lists one stage's options, and --dry-run on fetch, record
and build shows what they would write. Exit code 1 means validate or release found problems, 2 a
usage error and 3 that a stage could not run; see options and exit codes.
For Parquet outputs, set output_format = "parquet"
before the first [[source]] table in sources.toml, after installing the Parquet extra above.
CSV remains the default. Parquet writing and validation use batches of at most 10,000 rows;
see table memory limits.
sourceledger reads CSV (gzipped or not), JSON and Excel, by each source's format or its
URL's extension. Set format = "file" to keep a raster, archive or other file unchanged.
For another table format, see custom readers.
If another tool downloads a source, record its file
instead of fetching it.
What to commit
Commit sources.toml and data/fetches.jsonl. The log holds checksums and URLs, not
data: it's the history of every version you have fetched.
Build output is a local working dataset. A file source is copied unchanged, including
when redistribute = false. Check reuse terms before publication.
Keep data/raw/ and data/processed/ out of git, so the repository never redistributes
a publisher's data. The .fetch.json records live in data/raw/ too, so a fresh clone
runs fetch before build and validate.
Documentation
- Get started: follow the worked example to notice a revised source and rebuild the dataset.
- Configure and run: use the manifest and command reference, download limits and retries, and recipes for pooch, DVC, dlt, your own fetcher and custom readers.
- Inspect and share: consume JSON reports in CI, or create a
standalone HTML provenance report for dataset recipients
with
sourceledger report > provenance.html. - Understand the checks: read how it works, safe use, and what the checks establish.
- Choose and verify: see where sourceledger fits among related tools, or check a sourceledger release's signed provenance and reproducible build.
Project status
Stability
Until 1.0, the public API is sourceledger's __all__, the keys of sources.toml, the
format of fetch records and the log, and the CLI's stages, options, exit codes and --json
reports. A breaking change to any of them comes only in a
minor version, listed in CHANGELOG.md, with a warning first where that's
cheap. Older fetch logs stay readable. A record written by record(), or with
parameters, is not readable by 0.4.0: after a downgrade, run fetch again.
Roadmap
- An error class per kind of failure in the other stages, under
ValueErrorandOSError, once a caller needs to tell them apart. This will not break code that catches the base classes. - Comparing two versions of a table row by row, with the row keys the caller names, so a revision shows which values changed and not only that the bytes did. It starts as a pilot on real data, the archived World Development Indicators releases, before it becomes an API.
- A review by pyOpenSci once the project has users besides its own template.
Not planned:
- Templated, paginated or parallel downloads, an
updatecommand, or a plugin per download tool. Other tools fetch those files, andrecordlogs them (0005).
Ideas and requests are welcome as issues.
Development
You need uv, just, and Node 26 with
pnpm for the documentation site, which just check also builds.
uv sync
just check
The site is built with Astro from the Markdown in docs/. just site builds it into
site/dist/, and every push to main deploys it to GitHub Pages at
https://simonvanlierde.com/sourceledger/.
Contributing covers hooks, coding standards and tests. Governance explains project decisions. Report vulnerabilities through Security.
License
MIT. See LICENSE.
Metadata
Release files for sourceledger 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sourceledger-0.5.1.tar.gz | 63.0 kB | With provenance | Details for sourceledger-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sourceledger-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for sourceledger-0.5.1-py3-none-any.whl |
Total release size: 131.3 kB
Release files / sourceledger-0.5.1.tar.gz
| Download URL | sourceledger-0.5.1.tar.gz |
|---|---|
| Size | 63.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8afe3b86ef245b097a1ba26fbbd3bb2d335cc7f4a967289bf6ed33cb6d8fbf2e
|
|
BLAKE2b-256 checksum How to use checksums |
6ea5831117e45095739fb1baa746973f15a684536d32c6be13b576a39db1254e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / sourceledger-0.5.1-py3-none-any.whl
| Download URL | sourceledger-0.5.1-py3-none-any.whl |
|---|---|
| Size | 68.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cc3a83a8d2464e7de971caff20fc5db724362750eb1090b0c909f2192ede986
|
|
BLAKE2b-256 checksum How to use checksums |
37164b654637d53f8161a96f9f8cb3574e90ba9a9c7c747ec24e835cbb53513d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for sourceledger 0.5.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sourceledger-0.5.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA 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.