Skip to main content

A extremely fast Python library for the Levenshtein distance, written in Rust 🦀.

Project description

lev

lev is an extremely fast Python library for the Levenshtein distance and similarity ratio. Written in Rust. 🦀

Installation

uv add lev-rs

or if you prefer slow:

pip install lev-rs

Usage

import lev

lev.distance("kitten", "sitting")   # 3
lev.distance("résumé", "resume")    # 2
lev.distance("日本語", "日本")       # 1

lev.ratio("kitten", "sitting")      # 0.769...
lev.ratio("", "")                   # 1.0

For more details on the API see the API Reference.

Benchmarks

lev is benchmarked against the fastest Python Levenshtein libraries: rapidfuzz, editdistance, and edlib. We excluded slower implementations like pylev and python-Levenshtein.

Benchmarks were run on an Apple Mac Mini M2 Pro (macOS 26.2) using Python 3.13. Each string pair is exactly 100 characters long. Results represent the total wall time for 1,000 repetitions using Python's timeit. To reproduce, run scripts/benchmark.py.

ASCII

lev is significantly faster than the other libraries on 100-character ASCII strings.

ASCII benchmark – dark

Other Encodings

lev maintains its lead across all four CPython string-encoding kinds.

Latin-1

Latin-1 benchmark – dark

CJK

CJK benchmark – dark

Emoji

Emoji benchmark – dark

Contact

To get in contact, please open an issue or contact me via github@markusbilz.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lev_rs-0.2.0.tar.gz (195.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lev_rs-0.2.0-cp314-cp314-win_amd64.whl (112.6 kB view details)

Uploaded CPython 3.14Windows x86-64

lev_rs-0.2.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (204.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

lev_rs-0.2.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (373.1 kB view details)

Uploaded CPython 3.14macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

lev_rs-0.2.0-cp313-cp313-win_amd64.whl (112.8 kB view details)

Uploaded CPython 3.13Windows x86-64

lev_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (204.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

lev_rs-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (373.3 kB view details)

Uploaded CPython 3.13macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

lev_rs-0.2.0-cp312-cp312-win_amd64.whl (112.5 kB view details)

Uploaded CPython 3.12Windows x86-64

lev_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (203.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lev_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (372.8 kB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

lev_rs-0.2.0-cp311-cp311-win_amd64.whl (114.0 kB view details)

Uploaded CPython 3.11Windows x86-64

lev_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (204.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lev_rs-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (373.7 kB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

lev_rs-0.2.0-cp310-cp310-win_amd64.whl (114.2 kB view details)

Uploaded CPython 3.10Windows x86-64

lev_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (204.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lev_rs-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (374.0 kB view details)

Uploaded CPython 3.10macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file lev_rs-0.2.0.tar.gz.

File metadata

  • Download URL: lev_rs-0.2.0.tar.gz
  • Upload date:
  • Size: 195.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for lev_rs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0d408cdb7792acdb922cf83156d768b8f30fdf37c90d939b15284849699fe6ac
MD5 8ed81384981b3f4a531996cd47ce72c3
BLAKE2b-256 52357b639a8286775c63012e00157f709d1e2f06775b8499223a0ddc94d618bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0.tar.gz:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.2.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 112.6 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for lev_rs-0.2.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 2baf3a52391031060b2c43710d8bddf01df943ba26a74c8befbd469489162774
MD5 cfa4685856c5959d8f8f88480206d129
BLAKE2b-256 4f4f3b72c111ce6bad53e89fccc232056c27659a8ecd79286a5be514735c4313

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp314-cp314-win_amd64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7a7d5e8765150f880ae1e513526c80c5ca9e7a412ab9163b6ad788a96095b0de
MD5 f5d12b3f13a15c426becf4073c5ddfea
BLAKE2b-256 7672c48667592cfa7183ae98663a6793a67c31181b9299e2b1149ab0b6ca0182

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0f675ff349450f00d3f2152293df6b700cb1975ef9a72e29d6531acdc97db361
MD5 2fa1f610064b139064437cff5daa4603
BLAKE2b-256 0d7cd8d82440c0739ff0acf28393ff8e62fddd04157d4356381dcc0595f4a0b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 112.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for lev_rs-0.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b27da39fb1881cb93da49c2d010d2bc73eebfa2e008f7b223255886fd46a3917
MD5 401841471b9e768f912af17eef3641b2
BLAKE2b-256 43b8f16989a05d3e7948258767f2becebbe2c294f85c708a67aab0c73aae5384

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d251f76d18c5f60b0194516ae6448882fb5aea1ecd6b77b0504161c85777140
MD5 80dcd15460152b5c832f6744f0a0b378
BLAKE2b-256 14e05736f7dce8078e06621e7867d67f47a5100ad7ef35edc71e3b697f5024b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e04d840d82e145a9ccdd95166030a9d0aca1d3a766bfb9bb58b64529d7574994
MD5 66dfe9116f6be54b7f4bfa1f216226c1
BLAKE2b-256 35cb1343530840d172467bc2decc5ed4f369e8ec1df457f6a7299231a4767511

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 112.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for lev_rs-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2e0c807db962011ac1c50a799d2dfcf599e69f803b56c009a27d297ad01f7849
MD5 070f6702c2a97842d3d598476003f71f
BLAKE2b-256 3643c887430d082610aa780e17975076963a39254428166d0abcef89106692ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6a9aa086c8d86cd42c0f8e978bef236b4310ee50735204a31fa0167b4efbf320
MD5 c6bb115787102e83ffd3ec0be3a78520
BLAKE2b-256 ba0b5ad884ec510ba7012e7e5cb2a7a66f6d393653f69d1b4c674d26c5a2b683

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e3dcd922b2ac3030d96edd942d477e884b937ab557b7c04595d96869a20465b3
MD5 034b33a80eb42a8457428254a673e04d
BLAKE2b-256 96cb0af734bafbc52b2f07f2cf138a8dc4fac7af14bef16319985a97fbaebd97

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 114.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for lev_rs-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dfdcd2e5b3bc14e34932171a83a95a0650fb624fc11697aa26e317fd3074edfa
MD5 8512b5bcfd520cedb3a3038e752bbb19
BLAKE2b-256 508123f1cd7fa04ac6c247bff1ad600ee2196c7f6f9166ff1928e7d5def0b9c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp311-cp311-win_amd64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49eb80e6c3734cd143e5cce669b1996f69ca9e9a65fcc9ced68648dc26800e54
MD5 936ad569bf8a7a80befa0638de021b2a
BLAKE2b-256 406f2500fe77313f76a032a52bb9e74f26836e9c1ac3729ae80f21ae77504a3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 3f014debde6706516a9ca54a51e5d56add0fc9dadd03a25326fadc17462442b3
MD5 52590a852da1aefff86597ca5729408a
BLAKE2b-256 3729c92755a0122488374d9509fc44723ad0c8600404bba86e60a77c99126f97

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.2.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 114.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for lev_rs-0.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 59b634073252c259f3ba3966a96e8c5877110e5b9d8c5830834fd046971dda40
MD5 a9b04862ad6040d510ffc2ff0208cf81
BLAKE2b-256 8ce57433466406d407538deb893614fe4a81d543345a2bc5a9a9093fc8e0754d

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp310-cp310-win_amd64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 169281860b9b61c17fbe029172103445b55c92fe206c158e8d49eae87e99d9f1
MD5 9bcbee2252e49696c3566e2e6d0d3f96
BLAKE2b-256 587e7b5401432f9beb2d6d4cf1b4220c61a07954d309be08d5b2252694a7c45b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lev_rs-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for lev_rs-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9cd85441f9c995a6afd437729fcdacf174792c0104f386d1367ea9a3ea371348
MD5 ff97d7d1f1036c74b8ef164bb5fd0f99
BLAKE2b-256 91310f71b77f9df88a713d47f66551e23255734a174855246a44372028e4f6ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on KarelZe/lev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page