--- id: distance version: "0.1.3" license: UNKNOWN license_treatment: copyleft maintenance: abandoned --- # Distance — Utilities for comparing sequences License: copyleft · Maintenance: abandoned · Downloads: 690.2K/mo ## 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 above — verify before relying. Computes distance metrics (Levenshtein, Hamming, Jaccard, Sorensen) between arbitrary sequences, with pure Python implementations and optional C extensions for performance. 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 pip install distance uv add distance poetry add distance ## Installing Distance 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. 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) 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. 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: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 690.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sequence similarity metrics, levenshtein distance, string comparison, hamming distance, sequence alignment, text similarity, edit distance, string-matching, sequence-algorithms, abandoned [View on SkillFed](https://skillfed.io/packages/distance) · [View on PyPI](https://pypi.org/project/distance/)