dsdiff
A git-style diff between two dataset files: schema changes and column-level distribution drift, with a CI gate.
When a dataset is regenerated, columns quietly get renamed, retyped, gain
nulls, or shift distribution, and the pipeline keeps running while the model
degrades. There is no quick "git diff for data" a reviewer can read on a pull
request. dsdiff is that: point it at two files and it reports what changed,
ranked by how much it should worry you.
$ dsdiff diff yesterday.parquet today.parquet
severity column change detail
high income drift PSI 0.412
high signup_date column_added new column
medium age null_rate null rate 0.0% -> 7.3%
low country cardinality distinct values 41 -> 44
Install
$ pip install dsdiff # from PyPI, once released
$ pip install git+https://github.com/jmweb-org/dsdiff # latest, available now
Reads CSV, Parquet and JSON Lines through polars. No services, no schema files to author.
Usage
$ dsdiff diff a.csv b.csv # human-readable table
$ dsdiff diff a.csv b.csv --json # machine-readable findings
$ dsdiff diff a.csv b.csv --markdown # a table to paste into a PR
$ dsdiff diff a.csv b.csv --check # exit non-zero on a high-severity change
Commit a baseline
Profile a dataset once and compare future data against the saved profile, without re-reading the original file:
$ dsdiff profile reference.parquet -o baseline.json
$ dsdiff diff baseline.json new_batch.parquet --check
The baseline stores the bin edges, so drift on new_batch is measured against
exactly the same buckets as the reference.
In CI
- run: dsdiff diff baseline.json data/current.parquet --check
What it checks
- Schema: columns added, removed, or retyped (all high severity).
- Nulls: a jump in the null rate of a shared column.
- Cardinality: a categorical column gaining or losing distinct values.
- Distribution drift: the population stability index (PSI) per column, numeric columns binned by quantiles and categoricals by frequency.
Severity and the PSI scale
PSI is the standard tabular drift measure. The conventional reading is used
here: below 0.1 is low (no meaningful shift), 0.1 to 0.25 is medium,
and 0.25 or above is high. Schema and type changes are always high. By
default --check fails only on high-severity findings; pass --fail-on medium
to tighten the gate.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Ran; no blocking finding (or --check not set) |
| 1 | --check found a finding at or above the fail threshold |
| 2 | A file was missing or in an unsupported format |
License
MIT. See LICENSE.
Metadata
Release files for dsdiff 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dsdiff-0.2.0.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dsdiff-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.4 kB
Release files / dsdiff-0.2.0.tar.gz
| Download URL | dsdiff-0.2.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5bdf708c9209c879c9d565c6f9dcb05b84b3199760346c33e1460160e3fa373d
|
|
BLAKE2b-256 checksum How to use checksums |
9bf5bd06ff92300d0c514142b287d664f987aa1e6323c43f61511ee8c05545a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dsdiff-0.2.0-py3-none-any.whl
| Download URL | dsdiff-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab0eef8ac5e7cfb687d303241bd14a3d93c374a67a5a3b7544e1e02c57483c36
|
|
BLAKE2b-256 checksum How to use checksums |
e4dccac8fb24abf7693e68f8de3823cd2bc83fb775a04c39f0f46a601f34b154
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|