https://github.com/messense/py-dissimilar
A diff library with semantic cleanup
https://github.com/messense/py-dissimilar
Last synced: about 1 year ago
JSON representation
A diff library with semantic cleanup
- Host: GitHub
- URL: https://github.com/messense/py-dissimilar
- Owner: messense
- License: mit
- Created: 2022-12-31T04:21:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-24T13:25:51.000Z (about 3 years ago)
- Last Synced: 2025-04-15T04:11:50.531Z (about 1 year ago)
- Language: Rust
- Size: 20.5 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-dissimilar

[](https://pypi.org/project/dissimilar)
Python bindings to Rust [dissimilar](https://github.com/dtolnay/dissimilar) crate, a diff library with semantic cleanup.
## Installation
```bash
pip install dissimilar
```
## Usage
This module provides one function:
1. `def diff(a: str, b: str) -> List[Chunk]: ...`
```python
from dissimilar import diff, Equal, Delete, Insert
a = '[乀丁abcd一]'
b = '[一abcd丁]'
chunks = diff(a, b)
assert chunks == [
Equal("["),
Delete("乀丁"),
Insert("一"),
Equal("abcd"),
Delete("一"),
Insert("丁"),
Equal("]"),
]
```
## License
This work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file.