cdifflib is a Python library that provides a C implementation of parts of Python's standard `difflib` module, specifically focusing on `SequenceMatcher`. It creates a `CSequenceMatcher` type which inherits most functions from `difflib.SequenceMatcher`, offering up to 4x speed improvement when diffing large streams. The current version is 1.2.9, with irregular but ongoing maintenance releases to support newer Python versions and address issues.
pip install cdifflibVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate `CSequenceMatcher` and use its `find_longest_match` and `ratio` methods, similar to `difflib.SequenceMatcher`.
For optimal performance with large datasets, ensure that `a` and `b` are already `list` instances before passing them to the `CSequenceMatcher` constructor.
Verify that all items in your input sequences are hashable. Convert unhashable elements (like lists or dictionaries) to hashable equivalents (e.g., tuples or strings) if necessary before creating the `CSequenceMatcher`.
Upgrade to `cdifflib` version 1.2.0 or newer. If installing from source, ensure your environment has a compatible C compiler installed.
Ensure you are using `cdifflib>=1.2.0`. If the problem persists, ensure your system has a C compiler (e.g., `build-essential` on Linux, Xcode on macOS, C++ Build Tools on Windows) if a pre-compiled wheel is not available for your platform. Then, try `pip install --upgrade cdifflib`.
Modify your input sequences so that all their elements are hashable. For example, convert lists to tuples: `sm = CSequenceMatcher(None, [('a',), ('b',)], [('a',), ('c',)])`.Install the "Build Tools for Visual Studio" from the provided Microsoft link, ensuring you select the 'Desktop development with C++' workload. Alternatively, try to use a Python version for which `cdifflib` provides pre-compiled wheels.
No dependency data recorded yet.