diff-match-patch
Repackaging of Google's Diff Match and Patch libraries.
Decision gist · record as of 2026-08-14
Yes. The package is mature (first release 2011), has no security vulnerabilities, zero dependencies, and permissive licensing. Dormant maintenance is a minor concern, but the repository is active and tracks a maintained fork. Install it if you need robust diff, match, or patch operations for plain text—it's a well-established tool with low friction and proven algorithms.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies and support for Python 3.7 or newer.
- Dormant maintenance status (last release October 2024, 662 days ago) but repository is not archived and tracks a maintained fork as of August 2024.
License · maintenance · safety
permissive license (permissive) — Permissive Apache license allows commercial and private use without restriction, making it suitable for most projects without licensing concerns.
last release 2024-10-21 (662 days) · last repo commit 2025-01-01 · 59 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,799,032 downloads/mo, #2,227 on PyPI
Alternatives
Verify before relying
from diff_match_patch import diff_match_patch
dmp = diff_match_patch()
patches = dmp.patch_make(text1, text2)
diff = dmp.patch_toText(patches)
patches = dmp.patch_fromText(diff)
new_text, _ = dmp.patch_apply(patches, text)- Whether the maintained fork referenced (as of August 2024) is actively developed or if this package itself receives updates independently
- Performance characteristics and scalability limits for large text comparisons or patch operations
What it is and what it does
diff-match-patch is a Python port of Google's Diff Match and Patch library, originally built in 2006 to power Google Docs. It implements three core text-processing operations: diff (comparing two blocks of text and returning a list of differences), match (finding the best fuzzy match for a search string within a block of text), and patch (applying patches to text with best-effort recovery when the underlying text doesn't match exactly).
The library uses Myers' diff algorithm at its core, surrounded by pre-diff speedups and post-diff cleanups to improve both performance and output quality. It also implements a Bitap matching algorithm for flexible matching and patching. With no runtime dependencies and support for Python 3.7 or newer, it's straightforward to integrate into projects that need text synchronization, version control operations, or document comparison functionality.
Use it for
- Generate unified diff output between two text documents for version control or change tracking systems
- Find the best fuzzy match for a search string within a large block of text, weighted for accuracy and location
- Apply patches to text with graceful degradation when the exact context doesn't match
- Build document collaboration features that need to track and apply text changes
- Implement text-based merge or conflict resolution in plain-text workflows
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is mature (first release 2011), has no security vulnerabilities, zero dependencies, and permissive licensing. Dormant maintenance is a minor concern, but the repository is active and tracks a maintained fork. Install it if you need robust diff, match, or patch operations for plain text—it's a well-established tool with low friction and proven algorithms.
Install
diff-match-patch on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies and support for Python 3.7 or newer. Dormant maintenance status (last release October 2024, 662 days ago) but repository is not archived and tracks a maintained fork as of August 2024.
License in practice
Permissive Apache license allows commercial and private use without restriction, making it suitable for most projects without licensing concerns.
Quickstart
from diff_match_patch import diff_match_patch
dmp = diff_match_patch()
patches = dmp.patch_make(text1, text2)
diff = dmp.patch_toText(patches)
patches = dmp.patch_fromText(diff)
new_text, _ = dmp.patch_apply(patches, text)
Verify before relying
- Whether the maintained fork referenced (as of August 2024) is actively developed or if this package itself receives updates independently
- Performance characteristics and scalability limits for large text comparisons or patch operations
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 662 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,799,032 / month, #2,227 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseTopic :: Software Development :: LibrariesTopic :: Text Processing |
Evidence: diff_match_patch-20241021-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “patch generation and application”
- diff-match-patchProvides diff, match, and patch algorithms for comparing plain text,…
- langdiffLangDiff streams structured LLM outputs to frontends with granular,…
- bsdiff4bsdiff4 creates and applies binary patches in BSDIFF4 format,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also fast-diff-match-patch · patch · dictdiffer · whatthepatch · patch-ng · daff · unidiff2 · xmldiff · moreorless · fastdiff