Metadata-Version: 2.4
Name: cydifflib
Version: 1.2.0
Summary: Fast implementation of difflib's algorithms
Author-Email: Max Bachmann <pypi@maxbachmann.de>
Maintainer-Email: Max Bachmann <pypi@maxbachmann.de>
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Project-URL: Homepage, https://github.com/rapidfuzz/CyDifflib
Project-URL: Repository, https://github.com/rapidfuzz/CyDifflib.git
Project-URL: Issues, https://github.com/rapidfuzz/CyDifflib/issues
Project-URL: Changelog, https://github.com/rapidfuzz/CyDifflib/blob/main/CHANGELOG.md
Requires-Python: >=3.9
Description-Content-Type: text/markdown

<h1 align="center">
 CyDifflib
</h1>
<p align="center">
  <a href="https://github.com/rapidfuzz/CyDifflib/actions">
    <img src="https://github.com/rapidfuzz/CyDifflib/workflows/Build/badge.svg"
         alt="Continuous Integration">
  </a>
  <a href="https://pypi.org/project/cydifflib/">
    <img src="https://img.shields.io/pypi/v/cydifflib"
         alt="PyPI package version">
  </a>
  <a href="https://www.python.org">
    <img src="https://img.shields.io/pypi/pyversions/cydifflib"
         alt="Python versions">
  </a><br/>
  <a href="https://github.com/rapidfuzz/CyDifflib/blob/main/LICENSE">
    <img src="https://img.shields.io/github/license/rapidfuzz/CyDifflib"
         alt="GitHub license">
  </a>
</p>

<h4 align="center">CyDifflib is a fast implementation of difflib's algorithms, which can be used as a drop-in replacement</a>.</h4>


## 🚀 Benchmarks
The following [benchmark](https://github.com/rapidfuzz/CyDifflib/tree/main/bench) compares the performance in the original [difflib](https://docs.python.org/3.10/library/difflib.html) implementation, the library [cdifflib](https://github.com/mduggan/cdifflib) and CyDifflib

<p align="center">
<img src="https://raw.githubusercontent.com/rapidfuzz/CyDifflib/main/bench/CyDifflib.svg?sanitize=true" alt="Benchmark CyDifflib">
</p>

## ⚙️ Installation

You can install this library from [PyPI](https://pypi.org/project/cydifflib/) 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`:
```python
# from difflib import SequenceMatcher
from cydifflib import SequenceMatcher
```
The official [documentation of difflib](https://docs.python.org/3.10/library/difflib.html) 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 `thefuzz` this can be done in the following way:
```python
from cydifflib import SequenceMatcher
import difflib

difflib.SequenceMatcher = SequenceMatcher
from thefuzz import fuzz
```

## 👍 Contributing

PRs are welcome!
- Found a bug? Report it in form of an [issue](https://github.com/rapidfuzz/CyDifflib/issues). Any difference in behavior to difflib is considered as a bug.
- Can make something faster? Great! Just avoid external dependencies and remember that external behavior does not change.
- Have no time to code? Tell your friends and subscribers about CyDifflib.

Thank you :heart:

## ⚠️ License
Copyright 2021-present [Max Bachmann](https://github.com/maxbachmann). `CyDifflib` is free and open-source software licensed under the [MIT License](https://github.com/rapidfuzz/CyDifflib/blob/main/LICENSE).
