recipe: rapidfuzz 3.14.5#111
Open
ndonkoHenri wants to merge 3 commits into
Open
Conversation
Fast fuzzy string matching (flet-dev/flet#6717). Self-contained scikit-build-core + CMake + Cython C++ package, duckdb/pyzmq archetype, zero patches. The vendored rapidfuzz-cpp and Taskflow deps are header-only and bundled in the sdist, so there is no external native library to build. Notes: - RAPIDFUZZ_BUILD_EXTENSION=1 forces the compiled C++ extension; without it scikit-build-core silently falls back to a pure-Python wheel (no .so). - Its x86 SSE2/AVX2 SIMD variants are separate CMake targets gated on $RAPIDFUZZ_ARCH_X86/X64 (try_compile on __x86_64__/__i386__), so ARM slices build only the scalar path -- no x86 intrinsics reach the ARM compiler. - flet-libcpp-shared is an Android-only host dep (libc++_shared) for the C++ .so; iOS links the system libc++. Locally verified: ios_13_0_arm64_iphonesimulator builds clean (all five compiled modules incl. process_cpp_impl), MH_BUNDLE->MH_DYLIB fix applied, "C++ Extension built successfully".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a mobile-forge recipe for RapidFuzz 3.14.5 — fast fuzzy string matching (Levenshtein and other string metrics) with a C++ backend; an MIT-licensed, orders-of-magnitude-faster drop-in for fuzzywuzzy. Requested in flet-dev/flet#6717.
Why it's straightforward
RapidFuzz is a self-contained scikit-build-core + CMake + Cython C++ package — the duckdb/pyzmq archetype. Its only native "dependencies" are the header-only
rapidfuzz-cppandTaskflowsubmodules, both bundled in the PyPI sdist, so there's no external native library to build and no companion recipe (the base install has zero mandatory runtime deps). Built with zero patches.Recipe shape / notable decisions
RAPIDFUZZ_BUILD_EXTENSION=1inscript_env— without it, scikit-build-core silently falls back to a pure-Python wheel (no.so); this forces the compiled extension and fails loudly if the cross-build breaks.SSE2/AVX2are separate CMake targets gated onRAPIDFUZZ_ARCH_X86/X64(atry_compileon__x86_64__/__i386__), so ARM slices build only the scalar path — no x86 intrinsics ever reach the ARM compiler. On-device you get the scalar C++ implementation, still far faster than pure Python.flet-libcpp-sharedis an Android-only host dep (libc++_shared for the C++.so); iOS links the system libc++.Development.ModuleFindPython is satisfied by the standardCROSS_VENV_PYTHON/-DPython_*injection.Validation
import, the compiledrapidfuzz.fuzz_cppcanary,Levenshtein.distance, and a Taskflow-backedprocess.extractOne.iphonesimulator:arm64build verified (all five compiled modules;MH_BUNDLE → MH_DYLIBfix auto-applied).Consumer notes (usage & recommendations)
RapidFuzz is fast fuzzy string matching for Flet apps — search, autocomplete, dedupe, and fuzzy lookups, all computed on-device by its C++ core. It's a drop-in, much faster replacement for fuzzywuzzy, and MIT-licensed.
Install
Once published, just add it to your app's
pyproject.toml:No extra dependencies — the base install is self-contained. (
numpyis optional, pulled only via therapidfuzz[all]extra for array-batch ops; you don't need it for normal use.) Works on all Android ABIs (arm64-v8a, x86_64, armeabi-v7a) and iOS.Minimal example — a live fuzzy search that shows ranked matches with scores:
Type
appel→appleranks first;banna→banana. The scoring runs entirely offline in the compiled C++ extension.What you get
rapidfuzz.fuzz— similarity scorers (ratio,partial_ratio,token_sort_ratio,WRatio, …).rapidfuzz.process—extract/extractOne/cdistfor matching a query against many choices.rapidfuzz.distance— edit-distance metrics (Levenshtein,JaroWinkler,Hamming, …). The formerjarowinklerandrapidfuzz_capipackages are merged in, so you don't need them — and you don't needpython-Levenshteinfor distances.Threading — interactive search over a modest list (as above) is fine on the UI thread. For heavy batch work — deduping thousands of records, or a large
process.cdist— run it inpage.run_thread(...)so the UI stays responsive.Performance note — on mobile you get the scalar C++ path (the x86 SSE2/AVX2 kernels are x86-only and aren't part of the ARM build). That's still dramatically faster than any pure-Python fuzzy matcher — the compiled extension is active, not the fallback. Prefer
process.extract/cdistover Python loops for batch matching, and pick the lightest scorer that fits (ratiois cheaper thanWRatio).Offline — fully offline; no network, no data files, no storage wiring needed.