Skip to main content

Python implementation of the patiencediff algorithm.

Project description

This package contains the implementation of the patiencediff algorithm, as first described by Bram Cohen.

Like Python’s difflib, this module provides both a convenience unified_diff function for the generation of unified diffs of text files as well as a SequenceMatcher that can be used on arbitrary lists.

Patiencediff provides a good balance of performance, nice output for humans, and implementation simplicity.

The code in this package was extracted from the Bazaar code base.

The package comes with two implementations:

  • A Python implementation (; this implementation only requires a Python interpreter and is the more readable version of the two
  • A C implementation implementation (_patiencediff_c.c); this implementation is faster, but requires a C compiler and is less readable


To invoke patiencediff from the command-line:

python -m patiencediff file_a file_b

Or from Python:

>>> import patiencediff
>>> print ''.join(patiencediff.unified_diff(
...      ['a\n', 'b\n', 'b\n', 'c\n'],
...      ['a\n', 'c\n', 'b\n']))
@@ -1,4 +1,3 @@

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for patiencediff, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size patiencediff-0.2.2.tar.gz (28.8 kB) File type Source Python version None Upload date Hashes View
Filename, size patiencediff-0.2.2-cp39-cp39-manylinux2014_aarch64.whl (59.7 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size patiencediff-0.2.2-cp38-cp38-manylinux2014_aarch64.whl (60.6 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size patiencediff-0.2.2-cp37-cp37m-manylinux2014_aarch64.whl (60.0 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size patiencediff-0.2.2-cp36-cp36m-manylinux2014_aarch64.whl (59.0 kB) File type Wheel Python version cp36 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page