sdiff
Rich file comparison with a focus on structured and tabular data
About
sdiff is a diff tool and a library. You can use it to build diffs and compare strings, sequences,
arrays, nested sequences, matrices, texts, tables, files, etc. It runs Myers diff algorithm under the hood. Implemented
in python+Cython.
Features
sdiff is not a drop-in replacement for your diff tool. But it does some things nicely.
- You can use it for text as usual.
- sdiff supports tables
- pretty fast
- exposes low-level python API to compare/align arbitrary sequences
- The CLI sdiff tool can be used to compare entire directories while discovering file types on the fly. It can be fine-tuned to include/exclude files, align file names through regexes, set various similarity measures, provide colored reports in various formats.
Install
pip install sdiff
Install the latest git version
pip install git+https://github.com/pulkin/sdiff.git
Examples
CLI
> sdiff a.csv b.csv
comparing a.csv vs b.csv
Country Region Date Kilotons of Co2 Metric Tons Per Capita
- ----------- ------ ---------- --------------- ----------------------
(3 row(s) match)
3 Afghanistan Asia 01-01-2019 6080 0.16
4 Afghanistan Asia 01-01-2018 6070 0.17
5 Afghanistan Asia 01-01-2013 ---5990--- 0.19
+++6000+++
6 Afghanistan Asia 01-01-2015 5950 0.18
7 Afghanistan Asia 01-01-2016 5300 0.15
(1 row(s) match)
API
from sdiff.sequence import diff
print(diff(
['apples', 'bananas', 'carrots', 'dill'],
['apples', 'carrots', 'dill', 'eggplant']
).to_string())
a≈b (ratio=0.7500)
··a[0:1]=b[0:1]: ['apples'] = ['apples']
··a[1:2]≠b[1:1]: ['bananas'] ≠ []
··a[2:4]=b[1:3]: ['carrots', 'dill'] = ['carrots', 'dill']
··a[4:4]≠b[3:4]: [] ≠ ['eggplant']
Documentation
Visit https://sdiff.readthedocs.io/en/latest/
License
Metadata
Release files for sdiff 0.1.10
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 |
|---|---|---|---|---|
| sdiff-0.1.10.tar.gz | 265.1 kB | With provenance | Details for sdiff-0.1.10.tar.gz |
Release files / sdiff-0.1.10.tar.gz
| Download URL | sdiff-0.1.10.tar.gz |
|---|---|
| Size | 265.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db960779f180aac9646e3b0776fc2652eca2d52c87844c2f172fd67f47cd80d4
|
|
BLAKE2b-256 checksum How to use checksums |
686cb17299274a126cc12c560d6d6798fad168dda2bf1a063e8242f6730c9645
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Jun 11, 2025.
Transparency logSecurity for sdiff 0.1.10
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
1 file in this release has been uploaded with provenance metadata.
Attestation for sdiff-0.1.10.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 Jun 11, 2025.
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.