--- id: fast-diff-match-patch version: "2.1.0" license: Apache License 2.0 license_treatment: permissive maintenance: dormant --- # fast-diff-match-patch — Packages the C++ implementation of google-diff-match-patch for Python for fast byte and string diffs. License: permissive · Maintenance: dormant · Downloads: 494.5K/mo ## What it is and what it does fast_diff_match_patch is a Python wrapper around a C++ implementation of Google's diff-match-patch library, designed to compute differences between text or byte strings much faster than the pure-Python port. It exposes a single `diff()` function that takes two strings or bytes and returns a sequence of operations (delete, keep, insert) with their lengths or content, optionally formatted as patches. The package releases the Global Interpreter Lock during diffing, allowing use in multi-threaded applications. The library supports several tuning options: `timelimit` to cap computation time, `checklines` to optimize line-based text, `cleanup` to choose semantic or efficiency-focused post-processing, and `counts_only` to return operation lengths or full strings. It handles both Unicode strings and byte sequences, though Windows has limitations with characters outside the Basic Multilingual Plane. Use it for: - Generate diffs between code versions or document revisions for version control or review systems. - Detect and highlight changes in text files for diff viewers or collaborative editing tools. - Produce patch files for applying changes to source code or configuration. - Compare large documents or byte streams where pure-Python diff is too slow. - Integrate fast text comparison into multi-threaded applications without GIL contention. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Wraps the C++ implementation of google-diff-match-patch to perform fast string and byte comparisons, returning diff operations or patches. Yes, if you need fast string or byte diffs. The package is stable, permissively licensed, has no known vulnerabilities, and offers prebuilt wheels for common platforms. Maintenance is dormant but the code is mature; install friction is moderate due to compilation but mitigated by wheel availability. Not worth installing if you only diff small strings or can tolerate slower pure-Python performance. ## Install pip install fast-diff-match-patch uv add fast-diff-match-patch poetry add fast-diff-match-patch ## Installing fast-diff-match-patch Before you install: Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.6–3.12 on macOS, Linux, and Windows. Maintenance is dormant (last release 2024-04-23, last commit 2024-06-13), but the repository remains active and unarchived. License in practice: Licensed under Apache License 2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions. Quickstart: pip install fast_diff_match_patch from fast_diff_match_patch import diff changes = diff("Hello world.", "Goodbye moon.") for op, length in changes: print(f"{op}: {length} chars") Verify before relying: - Whether the package works reliably on Python 3.13+ despite classifier support only through 3.12. - Performance characteristics on very large documents compared to pure-Python alternatives. - Whether the GIL release during diff operations provides measurable benefit in typical multi-threaded scenarios. ## Package facts - License: Apache License 2.0 (permissive) - Python support: unspecified - Install friction: medium - Maintenance: dormant - Downloads: 494.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags fast string diff comparison, text difference detection, diff match patch python, byte string comparison, generate text patches, compare documents quickly, diff operations, text-comparison, performance-critical [View on SkillFed](https://skillfed.io/packages/fast-diff-match-patch) · [View on PyPI](https://pypi.org/project/fast-diff-match-patch/)