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 uv run python 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.2.tar.gz (194.0 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.2-cp314-cp314-win_amd64.whl (128.2 kB view details)

Uploaded CPython 3.14Windows x86-64

lev_rs-0.2.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (217.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

lev_rs-0.2.2-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (396.2 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.2-cp313-cp313-win_amd64.whl (128.6 kB view details)

Uploaded CPython 3.13Windows x86-64

lev_rs-0.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (218.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

lev_rs-0.2.2-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (397.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.2.2-cp312-cp312-win_amd64.whl (128.4 kB view details)

Uploaded CPython 3.12Windows x86-64

lev_rs-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (218.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lev_rs-0.2.2-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (396.6 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.2-cp311-cp311-win_amd64.whl (129.7 kB view details)

Uploaded CPython 3.11Windows x86-64

lev_rs-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (218.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lev_rs-0.2.2-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (397.8 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.2-cp310-cp310-win_amd64.whl (130.0 kB view details)

Uploaded CPython 3.10Windows x86-64

lev_rs-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (218.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lev_rs-0.2.2-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (398.3 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.2.tar.gz.

File metadata

  • Download URL: lev_rs-0.2.2.tar.gz
  • Upload date:
  • Size: 194.0 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.2.tar.gz
Algorithm Hash digest
SHA256 7d197ac6a979526c6ba89ae5bf890836f5988cda6e69ea7dcbf97aaa1625d216
MD5 158e87ad4d88adca49f697a2a93244f7
BLAKE2b-256 9e5e7b6e6ed34939f3e355fc8aff962eeec5e99e739aff3816b4402452efb5b7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.2-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 128.2 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.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 dfacaac52616e42d2a3baa8944dd2fbca4e0f7cd7fcf454a333bce563f84185a
MD5 ad347be66d77325a990bb96877269d49
BLAKE2b-256 bc602fdb3e763ee348077c37305ef9e07029bc6c09103b95aec03b9566a48ca4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f00187b06b5508332ab801a12c65dcecbd75e09edecfd252d1b0b6f921f079f
MD5 279850a7a50826323dc0dce1e5942dce
BLAKE2b-256 26fdf853a75a61ce5093214daa61347e7ff654717d3e84a277c3635eca0142e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.2-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.2-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.2-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d52da1f129fb0aaf9f7326e95252d6dcaa032f3957f2434021269cd78d3383c4
MD5 f0885ba9a813c810658844919f6a58e0
BLAKE2b-256 99a096d5cc83ac212877552949e5dedd8b96d1ef7bc10c9ad2dd9fb69f21145c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 128.6 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 98beafd971a193ac24e6c34fada5febd73225e628d32824688223d34c964590e
MD5 185da6434802f71d32ff4eabd9e5923c
BLAKE2b-256 e5f6ee6a590391c7881ca1d6daa4190623d88a70b22e06038233dcd6785ff508

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc93f901e12d2990d214b23db586ca5fab0c49251f6f74d6735f8a21ad81f519
MD5 54f01fac547617e096f2aac216efd489
BLAKE2b-256 2c813df0e1ee39bbb4bf2c77ce28f8129b23a7b5f89662aa17c3abc8da806060

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.2-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.2-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.2-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 92a9e4545afe4034cf9d9fd0a235d99529081cc1b6fced4c37788d1fd89447e7
MD5 1b48603d273767673acd6ff757d26405
BLAKE2b-256 161e59fb0a13c582fcd9a587ad616673009e5e694f56a62e0bb89e9ab5ac717d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 128.4 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7b085449f1b0fd177914b9c43d4414f27508d8c08a323ab96378b6069aeca633
MD5 dd186ece8c260a32fa2f0e83cb118b62
BLAKE2b-256 d2f29de9ec8f5b043bf85f8029f0d1b829f827f32de58e3e75e06b1c388a154e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8252016653ef8ac538353452582451ff48b0a5d2b5ede0db3a12249279997eb3
MD5 af860a1f59f53b6228a01bd0ea55b169
BLAKE2b-256 fd719c572d1d611b48654b1482b8f4b932d1652ac47e11df0c7f5e1680b6e064

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.2-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.2-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.2-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 bc2b978a8d2dd66d929063c72e384a8a1730845d83934a65b53bc55d6d9a7b99
MD5 a552e8d63166306c5f13b0da11dbbac4
BLAKE2b-256 6e180ac0c440cd8acc0cf9deed2c817d8736ae02b0851eb60ccac83a24bec1b3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 129.7 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a55180c27e9040730f65deacf013557f2c7f4f91f1d10f96ac4eca1f675d251a
MD5 e69a501cd19cb618a37d75bd11d4d639
BLAKE2b-256 e1adf77bb95bd3dac05de78aaf2b7f888aec7c7613a0993e5d7857f8fe8cec04

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 67e29541e123fea8c991a6faa4d40949c56e6e4b3537a3696153a4c593ceafad
MD5 c07d80016b1f9ffac0e240288f0a006d
BLAKE2b-256 142b4cd922475868fe5a357c04922821ba0b66b49e3be07f129394377519dec8

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.2-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.2-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.2-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 36cb2fc8972c6164d4393b056e3a95e3b9b1935a74ae3d346008365f34c309b9
MD5 958a06e3cef09a3503586cae896d809b
BLAKE2b-256 83f4d1ecc9b69e1c270a6b0aaec67778193f78aca4a6e1ced7192a3df09056d9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 130.0 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 851f79f4d16b0404438f24dd95a9b8112132bb201d104c42cbd084b28908af1b
MD5 4a06d0f117552a1f4d2f82420b94ae77
BLAKE2b-256 201e1945c4547714d170d8c5ff90c07869c040c05cfac72fcb959fc3584437da

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0302c6cee92f56fe38e1835dec2a1425edeb31f9318fe7245b934f9cc89a3d2b
MD5 bdee318c350433b25d76bcf428fad088
BLAKE2b-256 711732345daed4e70075b209873834e58c1a4013535e891558450e762622a74c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.2-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.2-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.2-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d3f14654cdd7ed893d399a531d8d27fa792b6df149809f8f7e75bcb55cb4fa34
MD5 557f91305f73c575a5deac1c787fa96f
BLAKE2b-256 a8dba2b7bc46e1543068e36198c9fbc3b9881a54ee3b1706ba48201376125a60

See more details on using hashes here.

Provenance

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