2021-04-05 15:23:46 +00:00
|
|
|
{ lib
|
2022-12-17 10:02:37 +00:00
|
|
|
, stdenv
|
2021-04-05 15:23:46 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, fetchFromGitHub
|
2022-04-27 09:35:20 +00:00
|
|
|
, cmake
|
|
|
|
, cython_3
|
2022-06-16 17:23:12 +00:00
|
|
|
, ninja
|
2022-04-27 09:35:20 +00:00
|
|
|
, scikit-build
|
2022-06-26 10:26:21 +00:00
|
|
|
, setuptools
|
2022-04-27 09:35:20 +00:00
|
|
|
, numpy
|
2021-04-05 15:23:46 +00:00
|
|
|
, hypothesis
|
|
|
|
, pandas
|
2022-04-27 09:35:20 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, rapidfuzz-cpp
|
|
|
|
, taskflow
|
2021-04-05 15:23:46 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "rapidfuzz";
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "3.0.0";
|
2023-03-15 16:39:30 +00:00
|
|
|
format = "pyproject";
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "maxbachmann";
|
|
|
|
repo = "RapidFuzz";
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-04-29 16:46:19 +00:00
|
|
|
hash = "sha256-rpUrMHIBr7sb0Cib6WYdLJ3KOPEgRnB0DCV/df1uE1A=";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
cython_3
|
2022-06-16 17:23:12 +00:00
|
|
|
ninja
|
2022-04-27 09:35:20 +00:00
|
|
|
scikit-build
|
2022-06-26 10:26:21 +00:00
|
|
|
setuptools
|
2022-04-27 09:35:20 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
rapidfuzz-cpp
|
|
|
|
taskflow
|
|
|
|
];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
preBuild = ''
|
|
|
|
export RAPIDFUZZ_BUILD_EXTENSION=1
|
2022-12-17 10:02:37 +00:00
|
|
|
'' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
|
|
|
export CMAKE_ARGS="-DCMAKE_CXX_COMPILER_AR=$AR -DCMAKE_CXX_COMPILER_RANLIB=$RANLIB"
|
2022-07-14 12:49:19 +00:00
|
|
|
'';
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
|
2022-12-17 10:02:37 +00:00
|
|
|
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
|
2023-03-04 12:14:45 +00:00
|
|
|
]);
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
];
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
preCheck = ''
|
|
|
|
export RAPIDFUZZ_IMPLEMENTATION=cpp
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-04-05 15:23:46 +00:00
|
|
|
hypothesis
|
|
|
|
pandas
|
2022-04-27 09:35:20 +00:00
|
|
|
pytestCheckHook
|
2021-04-05 15:23:46 +00:00
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
disabledTests = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
|
|
|
# segfaults
|
|
|
|
"test_cdist"
|
|
|
|
];
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
pythonImportsCheck = [
|
2023-04-29 16:46:19 +00:00
|
|
|
"rapidfuzz.distance"
|
2021-04-05 15:23:46 +00:00
|
|
|
"rapidfuzz.fuzz"
|
|
|
|
"rapidfuzz.process"
|
|
|
|
"rapidfuzz.utils"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Rapid fuzzy string matching";
|
2021-10-04 12:37:57 +00:00
|
|
|
homepage = "https://github.com/maxbachmann/RapidFuzz";
|
2022-12-17 10:02:37 +00:00
|
|
|
changelog = "https://github.com/maxbachmann/RapidFuzz/blob/${src.rev}/CHANGELOG.rst";
|
2021-04-05 15:23:46 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
};
|
|
|
|
}
|