1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 cmake, 7 cython, 8 ninja, 9 scikit-build-core, 10 numpy, 11 hypothesis, 12 pandas, 13 pytestCheckHook, 14 rapidfuzz-cpp, 15 taskflow, 16}: 17 18buildPythonPackage rec { 19 pname = "rapidfuzz"; 20 version = "3.13.0"; 21 pyproject = true; 22 23 src = fetchFromGitHub { 24 owner = "maxbachmann"; 25 repo = "RapidFuzz"; 26 tag = "v${version}"; 27 hash = "sha256-vwAqlTq4HIbmCL1HsHcgfVWETImxdqTsnenmX2RGXw8="; 28 }; 29 30 build-system = [ 31 cmake 32 cython 33 ninja 34 scikit-build-core 35 ]; 36 37 dontUseCmakeConfigure = true; 38 39 buildInputs = [ 40 rapidfuzz-cpp 41 taskflow 42 ]; 43 44 env.RAPIDFUZZ_BUILD_EXTENSION = 1; 45 46 preBuild = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) '' 47 export CMAKE_ARGS="-DCMAKE_CXX_COMPILER_AR=$AR -DCMAKE_CXX_COMPILER_RANLIB=$RANLIB" 48 ''; 49 50 optional-dependencies = { 51 all = [ numpy ]; 52 }; 53 54 preCheck = '' 55 export RAPIDFUZZ_IMPLEMENTATION=cpp 56 ''; 57 58 nativeCheckInputs = [ 59 hypothesis 60 pandas 61 pytestCheckHook 62 ]; 63 64 disabledTests = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ 65 # segfaults 66 "test_cdist" 67 ]; 68 69 pythonImportsCheck = [ 70 "rapidfuzz.distance" 71 "rapidfuzz.fuzz" 72 "rapidfuzz.process" 73 "rapidfuzz.utils" 74 ]; 75 76 meta = { 77 description = "Rapid fuzzy string matching"; 78 homepage = "https://github.com/maxbachmann/RapidFuzz"; 79 changelog = "https://github.com/maxbachmann/RapidFuzz/blob/${src.tag}/CHANGELOG.rst"; 80 license = lib.licenses.mit; 81 maintainers = with lib.maintainers; [ dotlambda ]; 82 }; 83}