Registry / data / edlib
library1.3.9.post1pypypiunverified

Edlib is a lightweight and super-fast C/C++ library for sequence alignment using various edit (Levenshtein) distance algorithms, with official Python bindings. It supports global, semi-global, and local alignment modes and can return distance, locations, or even the full alignment path. The current version is 1.3.9.post1, with releases typically driven by bug fixes and minor improvements rather than a strict schedule.

pip install edlib
INSTALL
IMPORT
SIG · EDLIB
E
edlib
datapythonv1.3.9.post1
Install
1.6s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.9.post1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

align
import edlib edlib.align(...)
from edlib import align
The primary `align` function is accessed directly from the `edlib` module, not as a top-level import.

This quickstart demonstrates how to use `edlib.align()` for basic sequence alignment, showing different `mode` and `task` parameters to get either the edit distance or the full alignment path.

import edlib # Global alignment (Needleman-Wunsch-like) result = edlib.align("apple", "aple", mode="NW", task="distance") print(f"NW Distance: {result['editDistance']}") # Semi-global alignment (ends don't cost) result = edlib.align("apple", "pple", mode="SHW", task="distance") print(f"SHW Distance: {result['editDistance']}") # Global alignment with path (more computationally intensive) result = edlib.align("apple", "apply", mode="NW", task="path") print(f"NW Distance with path: {result['editDistance']}") print(f"Alignment path: {result['alignment']}")
Debug
Known issues
gotchaOlder versions (pre-1.2.7) could freeze or exhibit incorrect behavior when the input alphabet was exactly 256 unique characters. While fixed, be mindful of extremely large or unusual character sets in older installations.
fix
Upgrade to edlib >= 1.2.7 or ensure your input sequences don't trigger this specific edge case in older versions.
affects: <1.2.7
gotchaWhen only the edit distance is needed, explicitly set `task='distance'` for optimal performance. Using `task='locations'` or `task='path'` involves additional computation to traceback the alignment, which is slower.
fix
Use `edlib.align(seq1, seq2, task='distance')` if you only need the numerical edit distance.
affects: All versions
gotchaProviding empty strings as query or target sequences in versions prior to 1.2.5 could lead to incorrect results or crashes. Modern versions handle this correctly.
fix
Upgrade to edlib >= 1.2.5. If stuck on an older version, pre-validate inputs to ensure sequences are non-empty.
affects: <1.2.5
gotchaSetting the `k` parameter (maximum edit distance) too aggressively low might result in `no solution found` even if a solution exists with a slightly higher distance. This was particularly buggy in v1.1.1 but is still a design consideration.
fix
Carefully choose `k` based on expected edit distances. If a solution is expected but not found, try increasing `k` or removing it (for unlimited distance).
affects: All versions, especially <1.1.2
Upgrade
Version history
1.3.9.post1latest on PyPI · released Sep 4, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
edlib — pip install edlib · libregistry