--- id: polyleven version: "0.11.0" license: unclear license_treatment: unclear maintenance: aging --- # polyleven — A fast C-implemented library for Levenshtein distance License: unclear · Maintenance: aging · Downloads: 4.7M/mo ## What it is and what it does Polyleven is a C-implemented library that calculates the Levenshtein distance (edit distance) between two strings. It measures how many single-character edits—insertions, deletions, or substitutions—are needed to transform one string into another. The library is designed to be fast across both short inputs like English words and long inputs like DNA sequences, with no external dependencies beyond Python itself. You use it by importing the `levenshtein()` function and passing two strings; it returns the distance as an integer. Optionally, you can provide a threshold as a third argument to stop early if the distance exceeds that limit, which can speed up comparisons when you only care whether strings are similar within a certain tolerance. Use it for: - Spell-checking and autocorrect: find candidate words within a fixed edit distance of a misspelled input. - Duplicate detection: identify similar records in datasets by comparing strings with a distance threshold. - DNA/protein sequence analysis: compute alignment distances for biological sequences. - Fuzzy string matching in search: rank results by similarity to a query term. - Data deduplication: flag records that are nearly identical but not exact matches. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Polyleven computes Levenshtein distance between two strings using a fast C implementation, with optional threshold support to skip expensive comparisons. Yes, if you need fast Levenshtein distance computation. The library is mature (Production/Stable), has no dependencies, supports current Python versions, and shows strong performance. Caveat: verify the license metadata before use in proprietary projects, as the license treatment is marked unclear despite the description claiming MIT. ## Install pip install polyleven uv add polyleven poetry add polyleven ## Installing polyleven Before you install: Medium install friction due to compiled wheels, but pre-built binaries are available for common platforms (Python 3.10–3.12 on macOS, Linux, Windows, and ARM). Last release was 186 days ago; repo is active and not archived. License in practice: License treatment is unclear in the metadata, though the description states MIT License. Verify the actual license terms before use in proprietary projects. Quickstart: pip install polyleven from polyleven import levenshtein print(levenshtein('aaa', 'ccc')) # Output: 3 print(levenshtein('acc', 'ccc', 1)) # With threshold: 1 Requires Python 3.8 or later; compiled wheels available for most platforms but source build may require a C compiler. Verify before relying: - License metadata is marked unclear despite description stating MIT—confirm actual license terms before use. - Performance claims in description (e.g., 2303420 pairs/sec) are from benchmarks on Python 3.5.3; current performance on modern Python versions unknown. ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: medium - Maintenance: aging - Downloads: 4.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags levenshtein distance, edit distance calculation, string similarity, fast string comparison, levenshtein threshold, dna sequence distance, string-similarity, edit-distance, c-extension [View on SkillFed](https://skillfed.io/packages/polyleven) · [View on PyPI](https://pypi.org/project/polyleven/)