Skip to content

messense/py-dissimilar

Repository files navigation

py-dissimilar

CI PyPI

Python bindings to Rust dissimilar crate, a diff library with semantic cleanup.

Installation

pip install dissimilar

Usage

This module provides one function:

  1. def diff(a: str, b: str) -> List[Chunk]: ...
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 file.

About

A diff library with semantic cleanup

Resources

License

Stars

Watchers

Forks

Packages

No packages published