editdistance
Fast implementation of the edit distance (Levenshtein distance)
What it is and what it does
editdistance is a Python library that calculates the edit distance (Levenshtein distance) between two sequences—the minimum number of single-character edits (insertions, deletions, substitutions) needed to transform one sequence into another. It wraps a C++ implementation with Cython bindings to achieve performance significantly faster than pure-Python alternatives. The library accepts strings or any hashable iterables (such as lists of words), making it more flexible than some competitors that only handle strings.
The package has no runtime dependencies and provides a single main function, `eval()`, that takes two sequences and returns their edit distance. It is commonly used in spell-checking, fuzzy matching, record deduplication, and natural-language processing tasks where approximate string matching is needed. The repository is archived and no longer actively maintained as of February 2024, though the last release (0.8.1) supports Python 3.8 and later with prebuilt wheels for major platforms.
Use it for:
- Spell-checking and typo correction by finding the closest matching word in a dictionary.
- Fuzzy record matching to identify duplicate or near-duplicate entries in databases.
- Approximate string search in text processing pipelines where exact matches are too strict.
- Sequence alignment in bioinformatics or computational linguistics for comparing word or token sequences.
- Similarity scoring in recommendation systems to find similar user queries or product names.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes the edit distance (Levenshtein distance) between two sequences using a fast C++ and Cython implementation, supporting strings and any hashable iterables.
Yes, if you need fast edit-distance computation and can accept an unmaintained package. The library is stable, has no known vulnerabilities, and prebuilt wheels minimize install friction on common platforms. However, be aware the repository is archived; no new features or security updates will be released. For active maintenance and ongoing support, consider alternatives, but for a straightforward, performant edit-distance calculation in an existing codebase, this remains a solid choice.
Install
editdistance on PyPI
pip
pip install editdistanceuv
uv add editdistancepoetry
poetry add editdistanceInstalling editdistance
Before you install
Medium install friction due to compiled wheels; binary distributions are available for common platforms (Linux, macOS, Windows across multiple architectures), but source builds require a C++ compiler. Repository is archived and unmaintained since February 2024.
License in practice
MIT license is permissive; you may use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install editdistance
import editdistance
editdistance.eval('banana', 'bahama')
# 2
Requires Python 3.8 or later; if no prebuilt wheel exists for your platform, a C++ compiler is needed to build from source.
Verify before relying
- Whether the archived repository will receive security patches or bug fixes in the future.
- Performance characteristics on very large sequences or in memory-constrained environments.
- Compatibility with Python versions beyond those explicitly tested in the wheel distribution.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 916 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 3,940,760/month — #2,439 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: editdistance-0.8.1-cp310-cp310-macosx_10_9_universal2.whl; editdistance-0.8.1-cp310-cp310-macosx_10_9_x86_64.whl; editdistance-0.8.1-cp310-cp310-macosx_11_0_arm64.whl; editdistance-0.8.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; editdistance-0.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; editdistance-0.8.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; editdistance-0.8.1-cp310-cp310-musllinux_1_1_aarch64.whl; editdistance-0.8.1-cp310-cp310-musllinux_1_1_i686.whl; editdistance-0.8.1-cp310-cp310-musllinux_1_1_x86_64.whl; editdistance-0.8.1-cp310-cp310-win32.whl; editdistance-0.8.1-cp310-cp310-win_amd64.whl; editdistance-0.8.1-cp311-cp311-macosx_10_9_universal2.whl; editdistance-0.8.1-cp311-cp311-macosx_10_9_x86_64.whl; editdistance-0.8.1-cp311-cp311-macosx_11_0_arm64.whl; editdistance-0.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; editdistance-0.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; editdistance-0.8.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; editdistance-0.8.1-cp311-cp311-musllinux_1_1_aarch64.whl; editdistance-0.8.1-cp311-cp311-musllinux_1_1_i686.whl; editdistance-0.8.1-cp311-cp311-musllinux_1_1_x86_64.whl
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
editdistpyComputes Levenshtein and Damerau-Levenshtein…
permissive · top 15,000 on PyPI
edlibEdlib calculates edit distance (Levenshtein…
permissive · top 15,000 on PyPI
pylevComputes the Levenshtein distance between two…
permissive · top 5,000 on PyPI
python-LevenshteinComputes Levenshtein edit distance, string…
copyleft · top 5,000 on PyPI
pyxDamerauLevenshteinComputes Damerau-Levenshtein edit distance…
permissive · top 15,000 on PyPI
polylevenPolyleven computes Levenshtein distance between…
unclear · top 5,000 on PyPI
textdistanceComputes distance and similarity between text…
permissive · top 5,000 on PyPI
DistanceComputes distance metrics (Levenshtein,…
copyleft · top 15,000 on PyPI
LevenshteinLevenshtein computes string edit distances,…
copyleft · top 1,000 on PyPI
aptedComputes the tree edit distance between two…
permissive · top 15,000 on PyPI