Fast implementation of difflib's algorithms
Low maintenance activity. Last release 20 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install cydifflibCyDifflib
CyDifflib is a fast implementation of difflib's algorithms, which can be used as a drop-in replacement.
🚀 Benchmarks
The following benchmark compares the performance in the original difflib implementation, the library cdifflib and CyDifflib
⚙️ Installation
You can install this library from PyPI with pip:
pip install cydifflib
CyDifflib provides binary wheels for all common platforms.
Source builds
For a source build (for example from a SDist packaged) you only require a C++11 compatible compiler. You can install directly from GitHub if you would like.
pip install git+https://github.com/rapidfuzz/CyDifflib.git@main
📖 Usage
The library can be used in the same way as difflib. Just use the cydifflib module instead of difflib:
# from difflib import SequenceMatcher
from cydifflib import SequenceMatcher
The official documentation of difflib explains how to use the library. If you work with a library which internally uses some of the algorithms of difflib it is possible to replace the implementation before importing this library. E.g. for this can be done in the following way: