Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.1.0
Filename, size File type Python version Upload date Hashes
Filename, size patiencediff-0.1.0-cp27-cp27m-win32.whl (28.1 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size patiencediff-0.1.0-cp27-cp27m-win_amd64.whl (29.3 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size patiencediff-0.1.0-cp35-cp35m-win32.whl (29.5 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size patiencediff-0.1.0-cp35-cp35m-win_amd64.whl (31.7 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size patiencediff-0.1.0-cp36-cp36m-win32.whl (29.6 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size patiencediff-0.1.0-cp36-cp36m-win_amd64.whl (31.7 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size patiencediff-0.1.0.tar.gz (20.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page