python-Levenshtein
Python extension for computing string edit distances and similarities.
What it is and what it does
Levenshtein is a Python C extension that provides fast computation of string edit distances and similarity metrics. It implements the classic Levenshtein algorithm along with related operations like approximate median strings and sequence similarity, making it suitable for fuzzy string matching, deduplication, and text comparison tasks where performance matters.
The package is actively maintained and supports current Python versions (3.10 through 3.14). It installs as a wheel with low friction and has no external runtime dependencies beyond the Python standard library. The copyleft GPL-2.0-or-later license means derivative works must be open-sourced under compatible terms.
Use it for:
- Fuzzy string matching in search or autocomplete systems where approximate matches are needed.
- Data deduplication by computing similarity scores between records to identify near-duplicates.
- Spell-checking and typo correction by finding the closest matching word in a dictionary.
- Record linkage in data integration pipelines to match entities across datasets.
- Sequence alignment in bioinformatics or text analysis workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes Levenshtein edit distance, string similarity, and approximate median strings through a C extension module for fast string comparison operations.
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and fills a specific need for fast string distance computation. The GPL-2.0-or-later license is a hard requirement only if you need to distribute proprietary code; for internal use or open-source projects it poses no barrier.
Install
python-levenshtein on PyPI
pip
pip install python-levenshteinuv
uv add python-levenshteinpoetry
poetry add python-levenshteinInstalling python-Levenshtein
Before you install
Low install friction with a pure wheel distribution. Actively maintained as of 2026-08-08 with recent releases; requires Python 3.10 or later.
License in practice
Licensed under GPL-2.0-or-later (copyleft). Any derivative work or distribution must comply with GPL terms; proprietary projects should review compatibility before use.
Quickstart
pip install levenshtein
from Levenshtein import distance
result = distance('kitten', 'sitting')
Requires Python 3.10 or later.
Verify before relying
- Whether the C extension compiles without additional system dependencies on all target platforms.
- Performance characteristics compared to pure-Python alternatives for typical workload sizes.
Package facts
| License | GPL-2.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — Levenshtein |
| Maintenance | actively maintained — 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,084,844/month — #1,248 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_levenshtein-0.27.4-py3-none-any.whl
Keywords: string, Levenshtein, comparison, edit-distance
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
editdistanceComputes the edit distance (Levenshtein…
permissive · top 5,000 on PyPI
LevenshteinLevenshtein computes string edit distances,…
copyleft · top 1,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
edlibEdlib calculates edit distance (Levenshtein…
permissive · top 15,000 on PyPI
strsimpyImplements a dozen string similarity and…
permissive · top 15,000 on PyPI
DistanceComputes distance metrics (Levenshtein,…
copyleft · top 15,000 on PyPI
fuzzysearchFinds approximate substring matches in text or…
permissive · top 15,000 on PyPI
pyxDamerauLevenshteinComputes Damerau-Levenshtein edit distance…
permissive · top 15,000 on PyPI