skillfed

editdistpy

Fast Levenshtein and Damerau optimal string alignment algorithms.

editdistpy v0.4.0 382.2K downloads/30d#7,091 on PyPI27
Permissive license MIT Active released

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 editdistpy

uv

uv add editdistpy

poetry

poetry add editdistpy

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Rust

Tags

levenshtein distanceedit distance algorithmstring similaritydamerau levenshteinstring alignment distancefuzzy string matchingoptimal string alignment
string-algorithmsfuzzy-matching

More Linguistic packages