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 convience 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 (_patiencediff_py.py); 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

Usage

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 @@
 a
+c
 b
-b
-c

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.1
Filename, size File type Python version Upload date Hashes
Filename, size patiencediff-0.2.1-cp35-cp35m-macosx_10_14_x86_64.whl (28.8 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size patiencediff-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl (28.8 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size patiencediff-0.2.1-cp36-cp36m-win_amd64.whl (32.3 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size patiencediff-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl (28.8 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size patiencediff-0.2.1-cp37-cp37m-win_amd64.whl (32.3 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size patiencediff-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl (28.9 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size patiencediff-0.2.1-cp38-cp38-win_amd64.whl (32.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size patiencediff-0.2.1.tar.gz (28.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page