Differ
Python library to calculate differences between objects.
Right now, it supports calculating differences between objects built up of dicts, lists, tuples and base types.
The major advantage compared to other diff tools is it is able to detect “slightly” changed objects that were repositioned in a list:
from differ import compare_objects
seq1 = [
{'a': 1, 'b': 1, 'c': 1},
{'a': 2, 'b': 2, 'c': 2},
{'a': 3, 'b': 3, 'c': 3},
]
seq2 = [
{'a': 30, 'b': 30, 'c': 3},
{'a': 2, 'b': 20, 'c': 2},
{'a': 1, 'b': 1, 'c': 10},
]
diff = compare_objects(seq1, seq2)
Result:
{'added': [],
'changed': [0, 1, 2],
'distance': 1.0,
'equal': [],
'removed': [],
'total': 3,
'changes': {
0: {
'diff': {
'added': [],
'changed': ['c'],
'changes': {'c': {'distance': 1.0, 'left': 1, 'right': 10}},
'distance': 0.3333333333333333,
'equal': ['a', 'b'],
'removed': [],
'total': 3},
'distance': 0.3333333333333333,
'pos': 2},
1: {
'diff': {
'added': [],
'changed': ['b'],
'changes': {'b': {'distance': 1.0, 'left': 2, 'right': 20}},
'distance': 0.3333333333333333,
'equal': ['a', 'c'],
'removed': [],
'total': 3},
'distance': 0.3333333333333333,
'pos': 1},
2: {
'diff': {
'added': [],
'changed': ['a', 'b'],
'changes': {'a': {'distance': 1.0, 'left': 3, 'right': 30},
'b': {'distance': 1.0, 'left': 3, 'right': 30}},
'distance': 0.6666666666666666,
'equal': ['c'],
'removed': [],
'total': 3},
'distance': 0.6666666666666666,
'pos': 0}}}
Changelog
v0.1.4
Added CHANGELOG.rst to distributed files (that was the problem!)
v0.1.3
Fixed issues with *.rst loading for long_description.
v0.1.1
Initial version, with support for base objects.
Metadata
Release files for differ 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 |
|---|---|---|---|---|
| differ-0.1.4.tar.gz | 3.4 kB | Without provenance | Details for differ-0.1.4.tar.gz |
Release files / differ-0.1.4.tar.gz
| Download URL | differ-0.1.4.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02ddf64dd8fe5ed15c40e23e22f86eeaca2fd827f41665e350cd8b67d918a0b2
|
|
BLAKE2b-256 checksum How to use checksums |
14fb2d248dee3b3c560bab20928908c33a85c15d7c64a8da6e72a3aaf27251f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for differ 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.