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

Uploaded CPython 3.14Windows x86-64

lev_rs-0.2.1-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.1-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.1-cp313-cp313-win_amd64.whl (112.8 kB view details)

Uploaded CPython 3.13Windows x86-64

lev_rs-0.2.1-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.1-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.1-cp312-cp312-win_amd64.whl (112.6 kB view details)

Uploaded CPython 3.12Windows x86-64

lev_rs-0.2.1-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.1-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.1-cp311-cp311-win_amd64.whl (114.0 kB view details)

Uploaded CPython 3.11Windows x86-64

lev_rs-0.2.1-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.1-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.1-cp310-cp310-win_amd64.whl (114.2 kB view details)

Uploaded CPython 3.10Windows x86-64

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

File metadata

  • Download URL: lev_rs-0.2.1.tar.gz
  • Upload date:
  • Size: 195.6 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.1.tar.gz
Algorithm Hash digest
SHA256 a43229fd79de775eb329027ecd32218d579f054fddd847a6d9b6c4b03ff7493d
MD5 1d90458959e81c9f44eb76d7f928213d
BLAKE2b-256 8de112441a4c93a0304062b7e25314a4f0fb5109e4f0c9c9caf635b7bac43c2e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.1-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.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7d3ff07cb9eabfc969c707920dbbf0d26f5f6d02824b9b8f7b994e8940a9cf0c
MD5 afa70f92945e910834680b3c544dbb83
BLAKE2b-256 85139b5ba29ddfa0aae6b1ffdc05ab3d5d4062376ba3e0077a596d29b764b1ef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c595eacc6cce0a05af649369a2e355c5d30652fe1473e68d641305a829962b25
MD5 156967f12e09bb97255efa6bdc00a1df
BLAKE2b-256 ba2f2c5b1a129767faeb91ce12a5b10d44078e136af6796ca409ad46fcdff1e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.1-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.1-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.1-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e91c2da192929a71f8471efd9408932d38e41360397e8f3b9f91530cf8934a37
MD5 18d00da4c29cb6033b99bc4c48d6453e
BLAKE2b-256 fe8846863eacd84a1b7a6a2fcdd0ae4d8cb80333d0c55c3d2d70edc20a3777ae

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.1-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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e6a59cda56ceabe396f3d6ac8b81098e66741b0a9e3569ecf28c0a952b4058b0
MD5 325cb96f111f6062ca1f77ca5d8eb845
BLAKE2b-256 f31d876bd27f49032885d5b18f1597685815c3deb141ff642367bbf8708346e1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 81c5631320a0d778c6591934bbc150f7b8d21379cc39e4f2c7382260fd9abeee
MD5 a82c1c67f394d8dc958eb223e6ec4501
BLAKE2b-256 846d37418f8dbecbe96b7020c3935054ac4477965084574a377222c754fd1adf

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.1-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.1-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.1-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e683418d0e1433e0fce4c858ca636b4907c7af8ff65b786e181875b95acff2b0
MD5 e9ec59c840417fe1322ac98f9225001d
BLAKE2b-256 62334a5a6d2a915acfe560098d1f45880f9492d5c4afba1cd241331bb8ba9f24

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 112.6 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 909b1b89afb01be82635efe43bbc451c9a75a956c5a8dfe6056fe7ea381574c1
MD5 1b31db04b2249fdbf0a502f4b5bb2140
BLAKE2b-256 fbe328741d8de29f93b48cb8148d7d27db45378faa0bf562e4d3136e2b61c689

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ac60caea016643df0a29a894438437b4380eb1e0d0ccae06f43fb442e2378be8
MD5 2a7c52e4e769df7da5674a172d56f873
BLAKE2b-256 604649fc692392d5b1a439185d14f6bd5736022a9060463d127425227276ede9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.1-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.1-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.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 acfb7650a38c61700d08622108ea432abfc38a5314346ab35c5ae23e506a0484
MD5 6d09adbf601971c75a984b326dff5135
BLAKE2b-256 61c33bb4ce6f3b86c3f165eddb03032fbb04342deac844ffa84e9bce61f80e3f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2287eadec2b427cdb42c883b526ebc8f0d59882288e9a5d6667767f79ee20958
MD5 7e177705d778247d6257d1583c243081
BLAKE2b-256 b872698d7f62de35eacc16633a795fb311a62f5dbb2bdf1d848ff0cac28fc71f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a7b111488f54dd36f8c08ef8d171776cd703f842f3a3d13d19d9909e4b0c1a8
MD5 3af431ad83e0c6f8f35197a3c8311192
BLAKE2b-256 fcd51ef34b36c2f509c8a335cdd814f9b57057acf61b56939367d2cb114635b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.1-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.1-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.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 bdb66208da62b746166ce256d42eadd3ea6cfb31ec4b12c8d9da7bb4aaf439d2
MD5 18f1edef471b2e7902ea7cd498b7eceb
BLAKE2b-256 d470e74886d50d4ed3a92ae647dea773f3c114003483ccf275a87bd78e34f40b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lev_rs-0.2.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 171d8172180cee2b1f630ee7b3b2af30ceefdaac93a7ceb00d8bac4338f6ab12
MD5 19e2abd01ebada45482d5ffa7aed1be6
BLAKE2b-256 8ac739ceb0276b8ad77f3dd1176034aa1b4baba10cecf4d6cf73b680dc866bc0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lev_rs-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76b4035c1ba4fbebffa0d98baf40bd48a149e545fecaeed04287ebebdac0ed50
MD5 fc3f3e59ddac9eb4077282079523f6a7
BLAKE2b-256 1966d6575ab0a67ed49fe3aa7d6f9e90973bc4a8170e09d12dcf394d20e2e710

See more details on using hashes here.

Provenance

The following attestation bundles were made for lev_rs-0.2.1-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.1-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.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 eb8b69f72f20fd8ffed523e1dc78c4d254132f86a39eb6dbe34113910c54e97a
MD5 1457d81241d181d32714b39510e68a85
BLAKE2b-256 4cfc4c423a498246a5c06de8dc5e336bdf93b9acd3f42fd0c4b5451041fb1800

See more details on using hashes here.

Provenance

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