Skip to main content

datasets-lint

ruff for training data. Audit a dataset for duplicates, PII, distribution problems and eval-set contamination — offline, on CPU, in one command, with a CI-friendly exit code.

$ datasets-lint run train.jsonl --report out.html
datasets-lint 0.1.0  ·  train.jsonl
  120,000 rows audited (of 120,000, seed 0)  ·  text=text  label=label

  ✓ stats      0.42s   120,000 rows · 0.00% empty · worst column 0.0% null
  ✗ dup       12.10s   18.20% near-duplicate (4,211 clusters), 12.00% exact
  ✗ pii        0.91s   0.41% of rows contain PII (email 487, phone 12, api_key 1)

  verdict: error — 2 errors, 0 warnings, 1 ok · 13.43s
  report → out.html

Why

datasets-lint HTML report

Every team that fine-tunes or publishes a dataset re-writes the same checks in a throwaway notebook: duplicates, PII, contamination. It is slow, inconsistent, and never runs in CI. datasets-lint packages it once:

  • fast — samples 100k rows by default and finishes in seconds, not hours
  • offline — no API keys, no cloud, no data leaves the machine
  • CI-native — exit 1 on threshold breach, JSON output, baseline diffing
  • readable — one self-contained HTML report you can attach to a dataset card or a PR
  • extensible — one check = one file; the plugin API is ~20 lines

Install

uvx datasets-lint --help        # run without installing
# or
pip install datasets-lint

Usage

datasets-lint run data.jsonl                       # text summary
datasets-lint run data.parquet --report out.html   # single-file HTML report
datasets-lint run train.jsonl test.jsonl --checks dup   # cross-split duplicate check
datasets-lint run data.csv --json-out report.json --fail-on warn
datasets-lint run data.jsonl --baseline prev.json  # did this PR make the data worse?
datasets-lint checks                               # list checks

Supported inputs: .jsonl, .ndjson, .json, .csv, .parquet.

Exit codes: 0 ok · 1 threshold breached · 2 usage/input error.

Checks

id what it finds default severity
stats empty rows, nulls, length percentiles, label balance error if >1% empty
dup exact + near duplicates (MinHash/LSH), cross-file overlap error if >2% near-dup
pii emails, phones, IPs, IBANs, SSNs, API keys (redacted) error on secrets
contamination overlap with eval sets (GSM8K, MMLU, HumanEval) planned for v0.2

Configuration

datasets-lint.toml in the working directory (or --config path):

[defaults]
sample = 100000
seed = 0
fail_on = "error"          # none | warn | error

[checks.dup]
threshold = 0.9            # Jaccard threshold for near-duplicates
num_perm = 64
shingle_size = 5
max_near_dup_pct = 2.0

[checks.pii]
max_error_findings_pct = 0.1
max_warn_findings_pct = 5.0

[checks.stats]
max_empty_pct = 1.0
max_null_pct = 50.0
min_label_pct = 1.0

Writing a check

# src/datasets_lint/checks/short.py
from datasets_lint.checks.base import Check, Context
from datasets_lint.dataset import Dataset
from datasets_lint.result import CheckResult, Severity


class ShortRowsCheck(Check):
    id = "short"
    title = "Short rows"
    description = "Flags texts under N characters."

    def run(self, ds: Dataset, ctx: Context) -> CheckResult:
        limit = ctx.threshold(self.id, "min_chars", 20)
        bad = [i for i, t in ds.texts() if 0 < len(t) < limit]
        pct = round(100 * len(bad) / max(ds.audited_rows, 1), 2)
        return CheckResult(
            check_id=self.id,
            title=self.title,
            severity=Severity.WARN if bad else Severity.OK,
            summary=f"{pct}% of rows are shorter than {limit} chars",
            metrics={"short_pct": pct},
            findings=[],  # add Finding(...) entries for samples
        )

Register it in src/datasets_lint/checks/__init__.py. Add a fixture and a test — that's it.

License

MIT

Metadata

Release files for datasets-lint 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 datasets-lint 0.1.0
File Size Uploaded Provenance Actions
datasets_lint-0.1.0.tar.gz 253.5 kB With provenance Details for datasets_lint-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 278.6 kB

Release files / datasets_lint-0.1.0.tar.gz

Download URL datasets_lint-0.1.0.tar.gz
Size 253.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5516654f284b0fcde260d7b50824a2c65d38cc510c169d93c3d0f4e135b0e905
BLAKE2b-256 checksum
How to use checksums
f5249cb6099b136bf32cea48c8ae233414c2d3bd81fce87f4226f194c01f8869
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 Oct 31, 2026.

Transparency log

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

Download URL datasets_lint-0.1.0-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c03c99941938d7669987ef4afeaf1912f96de9b20ff251d81f28e4797a0cda10
BLAKE2b-256 checksum
How to use checksums
dd04595a490903ff79cb95bb5438924dbd72a8983724b6791d9e75647a6a42e6
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 Oct 31, 2026.

Transparency log

Security for datasets-lint 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.

Full provenance

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

Select from 2 files

Attestation for datasets_lint-0.1.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 Oct 31, 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