editdistpy
Fast Levenshtein and Damerau optimal string alignment algorithms.
What it is and what it does
editdistpy is a compiled Python library that calculates edit distances—the minimum number of single-character edits needed to transform one string into another. It implements two algorithms: the classic Levenshtein distance (insertions, deletions, substitutions) and the Damerau-Levenshtein optimal string alignment distance (which also allows transpositions). The library is ported from a C# implementation and supports an optional `max_distance` parameter; when the distance would exceed this threshold, the function returns -1 instead of computing the full result, which can significantly speed up comparisons when you only care whether strings are "close enough" within a bound.
The package has no runtime dependencies and is distributed as precompiled wheels for modern Python versions (3.10–3.14) on common platforms. It is suitable for tasks like fuzzy string matching, spell-checking, duplicate detection, and record linkage where you need to measure how different two strings are. The library is actively maintained and carries an MIT license.
Use it for:
- Spell-checking or autocorrect: find candidate corrections by computing edit distances from a misspelled word to a dictionary.
- Duplicate detection: identify similar product names, user entries, or records that may refer to the same entity.
- Fuzzy search: rank search results by string similarity when exact matches are unavailable.
- Data deduplication: merge or flag records with similar identifiers or names across datasets.
- Typo tolerance in user input: accept user queries that are within a small edit distance of known commands or entities.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes Levenshtein and Damerau-Levenshtein edit distances between strings with optional early cutoff to return -1 when distance exceeds a specified threshold.
Yes, if you need fast edit-distance computation in Python. The library is actively maintained, has no external dependencies, installs cleanly on modern Python versions, carries a permissive MIT license, and shows good performance on short and medium strings. Install it if fuzzy string matching or similarity measurement is core to your application; skip it if you only need exact string matching or have no string-comparison requirements.
Install
editdistpy on PyPI
pip
pip install editdistpyuv
uv add editdistpypoetry
poetry add editdistpyInstalling editdistpy
Before you install
Medium install friction due to compiled wheels; however, prebuilt binaries are available for Python 3.10–3.14 across Linux, macOS (Intel and ARM), Windows, and musl systems, so installation typically succeeds without compilation. Actively maintained with a recent release.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
from editdistpy import levenshtein
import sys
string_1 = "flintstone"
string_2 = "hanson"
max_distance = sys.maxsize
result = levenshtein.distance(string_1, string_2, max_distance)
print(result) # 6
Requires Python 3.10 or later.
Verify before relying
- Whether the package is actively maintained beyond the recent release date (last commit and maintenance status are current as of the fact sheet date).
- Performance characteristics on very long strings or in high-throughput scenarios compared to alternatives.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 33 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 382,152/month — #7,091 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: editdistpy-0.4.0-cp310-cp310-macosx_10_12_x86_64.whl; editdistpy-0.4.0-cp310-cp310-macosx_11_0_arm64.whl; editdistpy-0.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; editdistpy-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; editdistpy-0.4.0-cp310-cp310-musllinux_1_1_aarch64.whl; editdistpy-0.4.0-cp310-cp310-musllinux_1_1_x86_64.whl; editdistpy-0.4.0-cp310-cp310-win32.whl; editdistpy-0.4.0-cp310-cp310-win_amd64.whl; editdistpy-0.4.0-cp311-cp311-macosx_10_12_x86_64.whl; editdistpy-0.4.0-cp311-cp311-macosx_11_0_arm64.whl; editdistpy-0.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; editdistpy-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; editdistpy-0.4.0-cp311-cp311-musllinux_1_1_aarch64.whl; editdistpy-0.4.0-cp311-cp311-musllinux_1_1_x86_64.whl; editdistpy-0.4.0-cp311-cp311-win32.whl; editdistpy-0.4.0-cp311-cp311-win_amd64.whl; editdistpy-0.4.0-cp312-cp312-macosx_10_12_x86_64.whl; editdistpy-0.4.0-cp312-cp312-macosx_11_0_arm64.whl; editdistpy-0.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; editdistpy-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Keywords: edit distance, levenshtein, damerau
Tags
More Linguistic packages
Detects and normalizes text encoding from…
permissive · top 100 on PyPI
tiktokentiktoken is a fast BPE tokenizer that converts…
permissive · top 1,000 on PyPI
chardetDetects character encoding and language in byte…
permissive · top 1,000 on PyPI
text-unidecodeConverts Unicode text to ASCII by…
copyleft · top 1,000 on PyPI
larkLark is a parsing library that builds abstract…
permissive · top 1,000 on PyPI
tree-sitterPython bindings to the tree-sitter parsing…
permissive · top 1,000 on PyPI
editdistanceComputes the edit distance (Levenshtein…
permissive · top 5,000 on PyPI
pyxDamerauLevenshteinComputes Damerau-Levenshtein edit distance…
permissive · top 15,000 on PyPI
strsimpyImplements a dozen string similarity and…
permissive · top 15,000 on PyPI
edlibEdlib calculates edit distance (Levenshtein…
permissive · top 15,000 on PyPI
LevenshteinLevenshtein computes string edit distances,…
copyleft · top 1,000 on PyPI
kaldialignComputes edit distance, alignment, and word…
permissive · top 15,000 on PyPI
polylevenPolyleven computes Levenshtein distance between…
unclear · top 5,000 on PyPI
pylevComputes the Levenshtein distance between two…
permissive · top 5,000 on PyPI
textdistanceComputes distance and similarity between text…
permissive · top 5,000 on PyPI
symspellpysymspellpy is a Python port of SymSpell v6.7.2…
permissive · top 15,000 on PyPI