Better-Diff
The problem we're solving:
Why is my code linting tool telling me there's a difference here?
--- a
+++ b
@@ -1,6 +1,6 @@
-Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
With a normal unified-diff, trailing whitespace that is removed is not highlighted (depending on how the log is saved, may even be removed...)
Similar issues exist with the last line being an empty line or not:
---a
+++b
@@ -4,4 +4,3 @@
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
-
What about that line is getting removed?
Our solution
Write this module to share a wrapper that calls difflib.unified_diff and augments the formatting output with lines to highlight:
- The difference between the last and the new line is whitespace being removed
- The difference is the absence of line endings at the end.
--- a
+++ b
@@ -1,3 +1,3 @@
-Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
? ^^
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\ No newline at end of file (b)
Metadata
Release files for better-diff 0.1.4
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 |
|---|---|---|---|---|
| better_diff-0.1.4.tar.gz | 3.7 kB | With provenance | Details for better_diff-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| better_diff-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for better_diff-0.1.4-py3-none-any.whl |
Total release size: 7.7 kB
Release files / better_diff-0.1.4.tar.gz
| Download URL | better_diff-0.1.4.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
920ca76bdbcd2f0c361fa5d9a2d4727624a3545d6cb467b1b6616cad8a634de7
|
|
BLAKE2b-256 checksum How to use checksums |
9567f57edc19d02f51ffbbc340dd00a7953f74f5eeb88d5b7c706abef2ecc26f
|
| 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 May 29, 2025.
Transparency logRelease files / better_diff-0.1.4-py3-none-any.whl
| Download URL | better_diff-0.1.4-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06e63358b2047ae2695abd96316f47c6d3c38b9e641f53012279878d66d8792e
|
|
BLAKE2b-256 checksum How to use checksums |
9f6490cc70ddc1b6fffe8cbf91102725593178601b8a5345476098a63b2e658f
|
| 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 May 29, 2025.
Transparency logSecurity for better-diff 0.1.4
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 better_diff-0.1.4.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 May 29, 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.