Skip to main content

levenshtein-pa

Origin & Attribution

  • Inspired by: python-Levenshtein & Python's difflib (edit-distance API) + standard 64-bit FNV-1a specification.
  • Implementation: 100% clean-room reimplementation from scratch in pure Pa (.pa) — zero C/C++ boilerplate, zero garbage collection, deterministic stack/RAII memory layout, compiled via LLVM -O2.
  • License: MIT

Benchmark vs. Original

Workload: Fuzzy match filter (dist <= 4) of a 36-byte query against 10,000 candidate strings (~40 bytes each, 1,000 matches), verified for 100% identical (index, distance) output across all three runs.
Environment: Linux x86-64 · CPython 3.12 · pac 0.1.0 --mode prod · isolated subprocess per mode, 3-run median (time.perf_counter + resource.getrusage Peak RSS).

Implementation Runtime Median Time Speedup Peak RSS
Pure Python (for loop) CPython 2,532.66 ms 1.0x 17.7 MB
levenshtein-pa single-call (levenshtein_pa.levenshtein) CPython + .so 62.60 ms 40.5x 17.7 MB
loop-template batch (custom_batch.filter_batch) CPython + .so 4.78 ms 530.0x 19.1 MB
Pure Pa Standalone (pac build --mode prod) Native (No Python) 7.52 ms 336.8x 1.7 MB

Note: CPython rows include the ~17 MB interpreter baseline; the +1.4 MB in loop-template mode comes from the contiguous UTF-8 corpus buffer, CSR offsets, and pre-allocated zero-copy output arrays (zero per-item PyObject* allocations inside the native loop). The Pure Pa Standalone row includes full OS process startup (fork/exec) and drops Peak RSS to 1.7 MB with zero Python runtime.

Reproduce locally:

python benchmarks/bench_levenshtein.py

Quick Usage

1. Python (Pre-compiled .so / .pyd, Zero ctypes)

pip install levenshtein-pa
import levenshtein_pa

levenshtein_pa.levenshtein("kitten", "sitting")                            # 3
levenshtein_pa.levenshtein_bytes(b"kitten", b"sitting")                    # 3
levenshtein_pa.fnv1a_64("foobar")                                          # 0x85944171f73967e8
levenshtein_pa.levenshtein_batch("kitten", ["sitting", "mitten", "bitten"])  # [3, 1, 1]

2. Pure Pa Standalone (Zero Python Runtime)

After pip install levenshtein-pa (via the pa_lang.libs entry point) or with -I packages/levenshtein-pa/pa:

from levenshtein import levenshtein_str, fnv1a_64_str
pac build --mode prod main.pa -o app

3. Custom Batch Loop (loop-template/)

To eliminate Python for-loop overhead on custom filtering/scoring workloads, edit only the marked loop body in loop-template/custom_batch.pa and compile directly to an importable .so:

cd packages/levenshtein-pa/loop-template
pac build --shared --mode prod -I ../pa custom_batch.pa -o custom_batch.so

Metadata

Release files for levenshtein-pa 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for levenshtein-pa 0.1.0
File Actions
levenshtein_pa-0.1.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for levenshtein_pa-0.1.0-cp313-cp313-win_amd64.whl
levenshtein_pa-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for levenshtein_pa-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
levenshtein_pa-0.1.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for levenshtein_pa-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
levenshtein_pa-0.1.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for levenshtein_pa-0.1.0-cp312-cp312-win_amd64.whl
levenshtein_pa-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for levenshtein_pa-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
levenshtein_pa-0.1.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for levenshtein_pa-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
levenshtein_pa-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for levenshtein_pa-0.1.0-cp311-cp311-win_amd64.whl
levenshtein_pa-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for levenshtein_pa-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
levenshtein_pa-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for levenshtein_pa-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 128.6 kB

Release files / levenshtein_pa-0.1.0-cp313-cp313-win_amd64.whl

Download URL levenshtein_pa-0.1.0-cp313-cp313-win_amd64.whl
Size 15.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
852d88fa7d5bee4253229f550dd5d73302aac10ef6f1fc649d321c2f9c72e9e7
BLAKE2b-256 checksum
How to use checksums
767e019feed53af8ab139742b5d1b9ed6fb5c99bbd03440dadb9d5f0488dd660
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL levenshtein_pa-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 15.0 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ddd5b85c971b7dfa5b5e725aa8a2b123c864898723ca70b14a12ba4307ab8c42
BLAKE2b-256 checksum
How to use checksums
540623d903e58b09e7bdecb199b94fac9b75d69b096f92b217c2fa672a07a136
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL levenshtein_pa-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Size 12.8 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2abab7125e3b6dcf43f82fdfd1814737a4398d6f697b530b395cca3b36d77d5c
BLAKE2b-256 checksum
How to use checksums
8b0f7ff8dbd4676104ff7bab29b367947866a0930a697ee1d5e6faf1354dc976
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp312-cp312-win_amd64.whl

Download URL levenshtein_pa-0.1.0-cp312-cp312-win_amd64.whl
Size 15.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
6dbf5938115e4b481b4a0f6340e5ba1772983d71286927672dbcd10248debab4
BLAKE2b-256 checksum
How to use checksums
1fe2ee30aab857b83b7cb6c9a2aa3e6fc803c1b72c0f19048eda4226ac405cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL levenshtein_pa-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 15.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4e507aed28584ea5d6b90d981a88dbfe4692ec8f47d3009af8489d20a6b20ce7
BLAKE2b-256 checksum
How to use checksums
294fcb7538a173256707b3522b94c64a418999b49bbbebbe8f0b7539bfaaf09f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL levenshtein_pa-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Size 12.8 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9665c8fea0fbdcb84b7fb594165adf42f865486c364c5c08288b177066c04c9f
BLAKE2b-256 checksum
How to use checksums
c3bce52a6a79275431c79196decdc170c4e8fc7d5261362a07f1320ab1b11da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp311-cp311-win_amd64.whl

Download URL levenshtein_pa-0.1.0-cp311-cp311-win_amd64.whl
Size 15.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
c9fd7ae8bea06b86a5b1f1fbe8990e989631064bc15db7f245434c817e9b518c
BLAKE2b-256 checksum
How to use checksums
9f946dcca0834b1d11108419bde0871ed71f30316bc3a43ec990b8721df949c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL levenshtein_pa-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 15.1 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
585640b547e08afaa7cb75ab83049da7c48ad795368481b5d39b4856c718cbd4
BLAKE2b-256 checksum
How to use checksums
8f5f6ed08cf220beff473d545b78a85f915b166b52f4562c98a9c88ff3ab5c61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / levenshtein_pa-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL levenshtein_pa-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 12.8 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d943e6891242249dcc917776cdbbfa9ba8431f47be89975db70c5e1fa0339105
BLAKE2b-256 checksum
How to use checksums
05c3aebc69915501cd7ee91bb3b9ba0f6727db3b5c12a43cf7d84b1e577bdd69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for levenshtein-pa 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for levenshtein_pa-0.1.0-cp313-cp313-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

9 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page