Skip to main content

sourceledger

python license DOI OpenSSF Scorecard CodSpeed

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:

  • fetch downloads the files and records their URLs, dates and SHA-256 checksums.
  • build writes tables with provenance columns, or copies file sources unchanged.
  • validate checks the outputs against the downloads and the manifest.

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. Python 3.12 or later is required; Linux and macOS are supported (POSIX). 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 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.

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

Project status

Stability

Until 1.0, the public API is sourceledger's __all__, the keys of sources.toml, and the format of fetch records and the log. 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.

Roadmap

  • A release stage that writes the metadata for a dataset release (RO-Crate, Croissant, CodeMeta, Zenodo and a SHA256SUMS file), checks each with its official validator, and keeps the data of redistribute = false sources out of the release.
  • An error class per kind of failure, under ValueError and OSError, once the release stage needs to tell them apart. This will not break code that catches the base classes.
  • A review by pyOpenSci once the project has users besides its own template.

Ideas and requests are welcome as issues.

Development

uv sync
just check

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.4.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 sourceledger 0.4.0
File Size Uploaded Provenance Actions
sourceledger-0.4.0.tar.gz 33.2 kB With provenance Details for sourceledger-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 67.4 kB

Release files / sourceledger-0.4.0.tar.gz

Download URL sourceledger-0.4.0.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e6744a88af3cf25bbe6b88c08e5e6a565cc5036788d11641df138fd81f47f606
BLAKE2b-256 checksum
How to use checksums
0bd8e40c30ea7338345c22e9860e3dff500515fad8cfa162a2d16d3e491910b7
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 1, 2026.

Transparency log

Release files / sourceledger-0.4.0-py3-none-any.whl

Download URL sourceledger-0.4.0-py3-none-any.whl
Size 34.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8134c5f7cdf66ce5d92a1477606eaae1d6b48a7acfeb49e16f6010c90ce7f070
BLAKE2b-256 checksum
How to use checksums
5340e87a5244815bb50c653b546cb32f36b696448337bcb63702b17c5e111a93
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 1, 2026.

Transparency log

Security for sourceledger 0.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sourceledger-0.4.0.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 1, 2026.

Transparency log

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.

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