Distance
Utilities for comparing sequences
Decision gist · record as of 2026-08-14
Yes, with conditions. The package is stable and has no known vulnerabilities, but it is abandoned and targets Python 3.3. Use it if you need a lightweight, dependency-free sequence distance library and can accept that it will not receive updates. If you need the C extension, expect build friction on modern systems. For new projects, consider whether a maintained alternative better fits your Python version and support expectations.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- If you want the C extension, you need a C compiler (GCC on Linux/Mac, MSVC on Windows) and Python development headers (python-dev package on Debian-like systems).
- The package targets Python 3.3; compatibility with modern Python versions is unverified.
- High install friction: requires a C compiler and Python development headers if you want the C extension.
License · maintenance · safety
UNKNOWN (copyleft) — Licensed under GPL (copyleft); using this package in proprietary code requires your work to be GPL-compatible or released under a compatible license.
last release 2013-11-21 (4649 days) · last repo commit 2019-10-31 · 117 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 690,153 downloads/mo, #5,332 on PyPI
Alternatives
Verify before relying
pip install distance
import distance
# Compare two strings
result = distance.levenshtein("lenvestein", "levenshtein")
print(result) # Output: 3
# Normalized Hamming distance
norm_result = distance.hamming("fat", "cat", normalized=True)
print(norm_result)- Whether the C extension builds successfully on modern Python versions (package targets Python 3.3)
- Current compatibility with Python versions beyond 3.3 and whether the package works on modern systems
- Whether the pure Python fallback is reliable enough for production use without the C extension
What it is and what it does
Distance is a sequence comparison library that implements several standard metrics for measuring similarity or difference between sequences—strings, tuples, or lists. It provides Levenshtein (edit distance), Hamming, Jaccard, and Sorensen metrics, all in pure Python, with optional C implementations for speed. The library also includes convenience functions like fast_comp for quick approximate distance checks and iterators for filtering large lists of sequences by similarity to a reference.
The package is designed for tasks like spell-checking, fuzzy matching, and finding similar items in collections. It has no runtime dependencies and can work entirely in Python, though building the C extension requires a compiler and Python development headers. The package is no longer maintained; its last release was in 2013-11-21.
Use it for
- Spell-checking or autocorrect: find candidate words close to a misspelled input using Levenshtein distance.
- Fuzzy string matching: identify similar records in datasets where exact matches fail.
- Sentence or document similarity: compare sequences of tokens to find related text passages.
- Filtering large lists: use ilevenshtein or ifast_comp to efficiently find items within a distance threshold of a reference sequence.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
The package is stable and has no known vulnerabilities, but it is abandoned and targets Python 3.3. Use it if you need a lightweight, dependency-free sequence distance library and can accept that it will not receive updates. If you need the C extension, expect build friction on modern systems. For new projects, consider whether a maintained alternative better fits your Python version and support expectations.
Install
distance on PyPI
Before you install
High install friction: requires a C compiler and Python development headers if you want the C extension. The package is abandoned (last release 2013-11-21, last commit 2019-10-31), so expect no maintenance or updates.
If you want the C extension, you need a C compiler (GCC on Linux/Mac, MSVC on Windows) and Python development headers (python-dev package on Debian-like systems). The package targets Python 3.3; compatibility with modern Python versions is unverified.
License in practice
Licensed under GPL (copyleft); using this package in proprietary code requires your work to be GPL-compatible or released under a compatible license.
Quickstart
pip install distance
import distance
# Compare two strings
result = distance.levenshtein("lenvestein", "levenshtein")
print(result) # Output: 3
# Normalized Hamming distance
norm_result = distance.hamming("fat", "cat", normalized=True)
print(norm_result)
Verify before relying
- Whether the C extension builds successfully on modern Python versions (package targets Python 3.3)
- Current compatibility with Python versions beyond 3.3 and whether the package works on modern systems
- Whether the pure Python fallback is reliable enough for production use without the C extension
Package facts
| License | UNKNOWN copyleft |
| Python support | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Abandoned 4,649 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 690,153 / month, #5,332 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: GNU General Public License (GPL)Natural Language :: EnglishOperating System :: OS IndependentProgramming Language :: CProgramming Language :: PythonProgramming Language :: Python :: 3.3Topic :: Software Development :: Libraries :: Python Modules |
Evidence: Distance-0.1.3.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “sequence similarity metrics”
- DistanceComputes distance metrics (Levenshtein, Hamming, Jaccard, Sorensen)…
- textdistanceComputes distance and similarity between text sequences using 30+…
- dtaidistanceComputes distance measures between time series using Dynamic Time…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also textdistance · strsimpy · editdistance · python-Levenshtein · pylev · polyleven · cyseq · pylcs · dtaidistance · suffix-trees