Python bindings for imara-diff, providing efficient diffing with identity preservation
Project description
imarapy
Python bindings for the imara-diff Rust library, providing efficient diffing for Python objects with identity preservation.
Features
- Fast Diffing: Leverages the
imara-diffRust crate for high-performance diffing. - Multiple Algorithms: Supports
histogram(default),myers, anddmp(diff-match-patch). - Object Support: Handles arbitrary Python objects by mapping them to unique tokens via
__eq__. - Identity Preservation: Returns the original object instances from your input lists in the diff results, respecting custom
__eq__implementations without losing object identity.
Installation
Via PyPI
pip install imarapy
Usage
import imarapy
before = ["line1", "line2", "line3"]
after = ["line1", "changed", "line3"]
# Default algorithm: histogram
deltas = imarapy.diff(before, after)
# Choose algorithm explicitly
deltas = imarapy.diff(before, after, algorithm="histogram") # imara-diff Histogram
deltas = imarapy.diff(before, after, algorithm="myers") # imara-diff Myers
deltas = imarapy.diff(before, after, algorithm="dmp") # diff-match-patch
for d in deltas:
print(d.type) # "Insert" | "Delete" | "Change"
print(d.source.position) # position in before
print(d.source.lines) # affected lines in before
print(d.target.position) # position in after
print(d.target.lines) # affected lines in after
Constants: imarapy.DELTA_TYPE_INSERT, imarapy.DELTA_TYPE_DELETE, imarapy.DELTA_TYPE_CHANGE
Please refer to demo.py for more usage examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imarapy-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 291.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8c7860519e2b6f23110a6b25bcf17d5fe0df5cdef234b40aa7ef688602a211d
|
|
| MD5 |
98be9f6fb3c5b2e14c8074a8964074a3
|
|
| BLAKE2b-256 |
eccca97584bc76638649fef31bf72e4f08b1b476a9980e9385539f968aa35a95
|
File details
Details for the file imarapy-0.3.2-cp312-cp312-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 280.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ba700e6ecf649f3f9feb2488933c3748d17f2d2fac53022df148b7fef0e3a8d
|
|
| MD5 |
fac4f06f9f568e8ee6a4a4a500086361
|
|
| BLAKE2b-256 |
9083afa0d47d888e267c5dcf91c3910563476fc4c52acb10b44fdab743a22e2b
|
File details
Details for the file imarapy-0.3.2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 282.8 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dd1264410b223c9c1b96969f52111fc2300ff7f625d6ae1829b6595e1537b60
|
|
| MD5 |
3fd0d9d91bc5e1163b258fd45890025f
|
|
| BLAKE2b-256 |
905e15a6caabdcdee5844a46d5619ac06326dbf6b4d342079cb861a1653517c1
|
File details
Details for the file imarapy-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 289.5 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
146ca6dff14dda891bb1cba013a7644a069f3ac33ccd253f25c6e34a4dddc2d4
|
|
| MD5 |
381bbab135a85b2bec4e19f7de05d8c4
|
|
| BLAKE2b-256 |
5ee522e9873d3fd636f6833013adc6b1c8b4bc7240a18bd912d0c75c0032c47d
|
File details
Details for the file imarapy-0.3.2-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 291.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe47cd99544cccaa345c779b59331d66727b6d9328083597fef4e36dd3308813
|
|
| MD5 |
20d0ac0ce872ebc505b341cc0dd4b1d4
|
|
| BLAKE2b-256 |
03b005fb3953c5ae6eacd82f97bfa39e1cfd6c12959532b672ab5c518c9c9986
|
File details
Details for the file imarapy-0.3.2-cp311-cp311-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 280.3 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fea06a166a4f87c965a6bb3d436978575ad01d10ac97091a334757a28253331a
|
|
| MD5 |
37be7076fef139940eeeef54ee8d2b6d
|
|
| BLAKE2b-256 |
59659a02792f2793a0e93a59c3a3233626ea1d5ba2e1c67855e4f36bef19c475
|
File details
Details for the file imarapy-0.3.2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 286.4 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e7c56779f4d66ddb5e167759208e24851dacb3fff0121902cfb737042d01e4e
|
|
| MD5 |
cbf033552993359b70b4168a9747a94e
|
|
| BLAKE2b-256 |
3e4c886fded82d79a2a314e3dcec4b805dac8afe1f67a1c6cd0a2b7756731b98
|
File details
Details for the file imarapy-0.3.2-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 292.2 kB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5936531055b49f45fe39e5613590a62e0915c532b542e4eaeea9e46093aa9e31
|
|
| MD5 |
48ca86330a70ed3e2b5b9921a5c1ff88
|
|
| BLAKE2b-256 |
534c719d48cbcef3a2177fe78b7766ec31cbfa746f8174187252fa41c40f6166
|
File details
Details for the file imarapy-0.3.2-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 291.8 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e70b384be49135f150f1821ff4eb9fce4e44590b25e74ecd39c2e0ed024ccaa
|
|
| MD5 |
8efb43f8ab8f91fc786e42107d3ae652
|
|
| BLAKE2b-256 |
0c9806bc5707af097fd1af38d0f12b009d7ef64a273b2730af258d5bb85340a4
|
File details
Details for the file imarapy-0.3.2-cp310-cp310-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp310-cp310-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 280.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e617c77b227a1b7f4e9f9491c25319cab5a18261e0926f298fba93981fca5a2
|
|
| MD5 |
d34f62a9e4a6a1f91b20678b454ae1ac
|
|
| BLAKE2b-256 |
7732b6c03c44edfb6c15896d38b323321cd5b3bcb4065a3012fa111249e29547
|
File details
Details for the file imarapy-0.3.2-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 286.4 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2885637bb4d7101b9ac2fd35a41c37730d9a60c58d60b9c98a469030599e457
|
|
| MD5 |
e7b0e18445fa41db468bd9fd361be0a6
|
|
| BLAKE2b-256 |
5d7c5c091aec7c6a3f4495675d16682861229bb65c1e294db1a7e4195ad6badc
|
File details
Details for the file imarapy-0.3.2-cp310-cp310-macosx_10_12_x86_64.whl.
File metadata
- Download URL: imarapy-0.3.2-cp310-cp310-macosx_10_12_x86_64.whl
- Upload date:
- Size: 292.3 kB
- Tags: CPython 3.10, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aca4080e497a459baece9f76bfb5216471e90b0ac3f8d19e217c438d1721be11
|
|
| MD5 |
3191dfd826b6a8ebb8465668e502ddf8
|
|
| BLAKE2b-256 |
317febf28cacad35e67f863eaec5c81c8ce4361429ad0721a8c0c10f762987f5
|