2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
fetchFromGitHub,
|
|
|
|
cmake,
|
|
|
|
cython,
|
|
|
|
ninja,
|
|
|
|
scikit-build,
|
|
|
|
setuptools,
|
|
|
|
numpy,
|
|
|
|
hypothesis,
|
|
|
|
pandas,
|
|
|
|
pytestCheckHook,
|
|
|
|
rapidfuzz-cpp,
|
|
|
|
taskflow,
|
2021-04-05 15:23:46 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "rapidfuzz";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "3.9.2";
|
2024-01-25 14:12:00 +00:00
|
|
|
pyproject = true;
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
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}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-mPfS/p/Gwc/aobTZMJqbUkpEq60PC7DSiAXBanlNt+8=";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2024-04-21 15:54:59 +00:00
|
|
|
--replace-fail "Cython >=3.0.9, <3.1.0" "Cython"
|
2024-01-13 08:15:51 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
build-system = [
|
2022-04-27 09:35:20 +00:00
|
|
|
cmake
|
2024-04-21 15:54:59 +00:00
|
|
|
cython
|
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
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
preBuild =
|
|
|
|
''
|
|
|
|
export RAPIDFUZZ_BUILD_EXTENSION=1
|
|
|
|
''
|
|
|
|
+ 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
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (
|
|
|
|
lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
|
|
|
|
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
|
|
|
|
]
|
|
|
|
);
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
full = [ numpy ];
|
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|