ztane

python-Levenshtein: Fast String Similarity for Python

python-Levenshtein is a C extension for Python that computes Levenshtein edit distance and related string similarity measures. It also provides edit operations, string averaging, and sequence and set comparisons for ordinary and Unicode strings.

View on GitHub Compare
Stars
1.3k
Forks
151
Stars, last 30 days
+0
Last commit
5.2 years ago
Contributors
10

Our take

Inactiveno commits in over a year

Health score

27/100

How it is scored
Activity
19
Community
46
Issues
21
Pull requests
20

+0 stars in the last 30 days

This is a focused C-backed string comparison library, but its inactive maintenance status makes adoption a decision that should account for project upkeep and GPL-2.0 obligations.

Good fit if

  • You specifically need edit distance, string similarity, or approximate string averaging in Python.
  • You can use GPL-2.0 software and are prepared to assess compatibility with your project.
  • You can evaluate and maintain an inactive dependency, or use the standalone C interface where appropriate.

Look elsewhere if

  • You need a project with recent commits, releases, or demonstrated issue and pull-request handling. The repository is marked inactive, with no recent commits or releases and no issues closed or pull requests merged in the measured period.
  • GPL-2.0 is incompatible with your distribution or licensing requirements.
  • You need documented standalone C APIs: the README says separate documentation for that interface is not provided.
All health signals
Last commit2021-08-11 (5.2 years ago)
Commits, last 90 days0
Releases, last 12 months0
Contributors10 (top contributor: 61% of commits)
Issues closed, last 90 days0
Pull requests merged, last 90 days0
Project age12 years

Checked on 2026-10-19 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

1,276

Forks

150

Change since Nov 16, 2026: -1 stars·0 forks

Overview

python-Levenshtein is a Python C extension built around the Levenshtein edit-distance algorithm. It provides fast string distance and similarity calculations, helping Python developers compare text without implementing those operations themselves. The project supports ordinary and Unicode strings.

The package also includes related string and sequence tools, and its C source can be compiled as a standalone library with NO_PYTHON. It is aimed at developers who need edit-distance-based comparisons or string averaging in Python or C.

Key Features

  • Computes Levenshtein edit distance and edit operations.
  • Calculates string similarity.
  • Produces approximate median strings and other string averages.
  • Measures similarity between string sequences and sets.
  • Works with ordinary and Unicode strings.
  • Includes StringMatcher.py, a SequenceMatcher-like class with a different feature set.
  • Can be compiled as a C library by defining NO_PYTHON.

Use Cases

  • A Python developer can compare user-entered text with a known string to identify likely spelling or typing differences.
  • A data-processing workflow can use string distances or similarity scores to compare names and other text values.
  • A project handling collections of strings can compare sequences or sets rather than only individual strings.
  • A C developer can use the library's standalone compilation mode when Python bindings are not needed.

What you need

Detected in the repository

  • Python (from setup.py)

License in plain words

GPL-2.0strong copyleft

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the license notice
  • Share your changes: yes, the full source of anything you distribute that includes it, under the GPL

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install from PyPI:

pip install python-Levenshtein

See the repository README for project details and documentation links.

Alternatives

  • textdistance: textdistance offers 30+ sequence distance and similarity algorithms with a common interface, while python-Levenshtein focuses on Levenshtein-related measures and edit operations.
ProjectLanguageLicenseStarsStatus
python-LevenshteinCGPL-2.01.3kInactive
textdistancePythonMIT3.5kInactive

Considerations

The project is marked inactive, and its last recorded commit was in 2021. It has ten contributors, but the available health data reports no recent commits, releases, issue closures, or merged pull requests. Contributor activity is not flagged as concentrated, so the main maintenance concern is inactivity rather than dependence on one person.

The README describes Python 2.2 or newer and Python 3 support, but does not establish compatibility with current Python versions. It also notes that the standalone C interface has no separate documentation and differs from the Python extension's exports and Unicode character type. The project is GPL-2.0-or-later, so check its terms against your intended use and distribution.

Found this useful?

Share it with someone who would like python-Levenshtein.

Comparisons