--- id: editdistpy version: "0.4.0" license: MIT license_treatment: permissive maintenance: active --- # editdistpy — Fast Levenshtein and Damerau optimal string alignment algorithms. License: permissive · Maintenance: active · Downloads: 382.2K/mo ## 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 above — 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 pip install editdistpy uv add editdistpy 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_current - Install friction: medium - Maintenance: active - Downloads: 382.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags levenshtein distance, edit distance algorithm, string similarity, damerau levenshtein, string alignment distance, fuzzy string matching, optimal string alignment, string-algorithms, fuzzy-matching [View on SkillFed](https://skillfed.io/packages/editdistpy) · [View on PyPI](https://pypi.org/project/editdistpy/)