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.1.0.tar.gz (195.7 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.1.0-cp314-cp314-win_amd64.whl (112.6 kB view details)

Uploaded CPython 3.14Windows x86-64

lev_rs-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (204.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

lev_rs-0.1.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.1.0-cp313-cp313-win_amd64.whl (112.7 kB view details)

Uploaded CPython 3.13Windows x86-64

lev_rs-0.1.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.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (373.2 kB view details)

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

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

Uploaded CPython 3.12Windows x86-64

lev_rs-0.1.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.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (372.7 kB view details)

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

lev_rs-0.1.0-cp311-cp311-win_amd64.whl (113.9 kB view details)

Uploaded CPython 3.11Windows x86-64

lev_rs-0.1.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.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (373.6 kB view details)

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

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

Uploaded CPython 3.10Windows x86-64

lev_rs-0.1.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.1.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.1.0.tar.gz.

File metadata

  • Download URL: lev_rs-0.1.0.tar.gz
  • Upload date:
  • Size: 195.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 c51866f00452eba7ee5969a4324214e5e1301dd4b154990d9597e483838a91b2
MD5 c89d9e47f0266bc64b61fc31cf4cf8c2
BLAKE2b-256 29c0c93684b1f70498c00e15f2843be425094e025e55518948e09187d41e4276

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.1.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.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ae52d29b4aa37a9351b220828a64fa9f796c645896ec8ea371bb3ed62e47b26c
MD5 172c39692fcd826f620908030cc87a30
BLAKE2b-256 da419433aafcb1e3aa50b2b0af4721285272a35804c903e63417cabf2368125a

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 51372551a6fa6e72639b7fcef846d5d0022c80a83cb9dd28555055d9be393f49
MD5 18029d272e1a846aa4b4888f231e88dc
BLAKE2b-256 f852a9fb416b6ea007b200fac195d007cfedaf5ef216bf4f31dadcaa6f866bab

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.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.1.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 3341d6260fcfd1aabc8c02699b87bb2fdc3d17e5ed7f9fd9490989948385c078
MD5 620da0fbc9b45417e5ebf8eb07f8d7fd
BLAKE2b-256 bc93cb715ab8e149165ff9f4a06ba508112c515e428895205c6f3aa560f77db3

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 112.7 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.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3606e40de563c21fff14b624d93710cb5169561b403ce365227d4673f47f79a6
MD5 ecf5f16df2a54926ada86fd71d7ee1d1
BLAKE2b-256 a31b8cbb28f421646dcdd7249b605a9759102735617742e8f7fcb80b77a6a38c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b678c31ce12a98a2730dcac6a74012fe8922c5cb386e34b603006ce20b95131e
MD5 67365bc5edfb662ab89bbfea615dd66d
BLAKE2b-256 519f96c8cafc108ba0648ab057297997e60dbdfb08d519e98e1020ac2a3265eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.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.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 307069e2f4618c33b04a9d2b80de021995f21f52e4870e9d833824dd1dd12efe
MD5 216eadfb52e923e6dec5a1384afe2b27
BLAKE2b-256 a893721c9c0bbe7cb792eca2782de645e826e6ad5e8060cc531eabb0c0004976

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.1.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.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4f22f967841a3cca97a3394ff4058efd98de2d60a009705db2df4e7b0145ed4b
MD5 ce537400ff901f29abca0c3769ae762e
BLAKE2b-256 50591280b28988990ae04160ed8db990469a81cb1ce4806556d347ce42c5ec39

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 44b4941293a5e4fa740de7347f7c9d34ce468a77e3aa2a51b01e4a414bf5fd32
MD5 029faae5b3c844d8e4dda5fe609a0d79
BLAKE2b-256 cd7bc4fa457790fcb4402dab59104782f0e950edae094dea960a3212b70a9905

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.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.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 8cfbe47587322b3eb70bd9c6ca7c2273fb8441d7c63da07e0642e6f2c00b262f
MD5 a5908c58d5498834d65b1cd63b98a2ee
BLAKE2b-256 a8685b552e85fabf6e4f3af98f89baacc8b2e5746836c5776cfc5eb0d0b1d017

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 113.9 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.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e85f2702d3055c14deefe5fe1bf085170e7ebaeeca4ac79044a2e2b70f566b44
MD5 2f6e9dec237a272ed4295dfbe7b299a1
BLAKE2b-256 39a54c8dbf678dabfeeecc5b17d41f78818354d1899a8fcb6a81f8b2b9b1515c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 025cd8675dd54d3c2ccca0d2eacf468989f77819b3bec6528b3ccf22c00685cc
MD5 64a69aa95caf2603f06c28a0e6c1ed5a
BLAKE2b-256 c24499fec4985fa3f6381fcd09cff60bfe985a5421bcfc571267e33f5b55ac8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.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.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 623482acb9c293c1f5d9c6923781cceeb8ee894ecd41cbfdeb5e8ee05d8855bf
MD5 3a77aed82d6dd17c283fd462ed4f16fe
BLAKE2b-256 c575f46ebbbb8124174e69a6236aa246e0959c362e65073011e391927c47c9f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: lev_rs-0.1.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.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a60e62c87f4db27b14b8ecea63c5d5405a680cf3305931ebe61a559833899da5
MD5 236d29755fdf57e3a18cc411fcaedfb4
BLAKE2b-256 0310c3060d1c6935350ed109c16d2d228c840c838932271a529a6a80d02140c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lev_rs-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd258967be05920deaf4d60f6c73ba145104570f7741f2508cb03f5811e747ec
MD5 15c441cd490cbb2803b6e31c1e7bf8a3
BLAKE2b-256 69d38e974dc601dd4a6a1fff972fc90a61113a9f1dde2f48cf556e9c9aa31cd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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.1.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.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 1e3bf1fe0210fe244715b2c43b4897362d9bb57fc570f36a84dbc0de55f86114
MD5 be6468247876c3e6e5e98f8eed98f5b9
BLAKE2b-256 2b3d8f250850c4c885a2c9937662d9cee779fcc12e7aa797bce1f901fd61e3bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.1.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