nixpkgs/pkgs/development/python-modules/rapidfuzz/default.nix
Guillaume Girol 33afbf39f6 treewide: switch to nativeCheckInputs
checkInputs used to be added to nativeBuildInputs. Now we have
nativeCheckInputs to do that instead. Doing this treewide change allows
to keep hashes identical to before the introduction of
nativeCheckInputs.
2023-01-21 12:00:00 +00:00

88 lines
1.7 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, cmake
, cython_3
, ninja
, scikit-build
, setuptools
, numpy
, hypothesis
, pandas
, pytestCheckHook
, rapidfuzz-cpp
, taskflow
}:
buildPythonPackage rec {
pname = "rapidfuzz";
version = "2.13.7";
disabled = pythonOlder "3.7";
format = "pyproject";
src = fetchFromGitHub {
owner = "maxbachmann";
repo = "RapidFuzz";
rev = "refs/tags/v${version}";
hash = "sha256-ZovXYOoLriAmJHptolD135qCn7XHeVvzLJNzI08mqwY=";
};
nativeBuildInputs = [
cmake
cython_3
ninja
scikit-build
setuptools
];
dontUseCmakeConfigure = true;
buildInputs = [
rapidfuzz-cpp
taskflow
];
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"
'';
NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
];
propagatedBuildInputs = [
numpy
];
preCheck = ''
export RAPIDFUZZ_IMPLEMENTATION=cpp
'';
nativeCheckInputs = [
hypothesis
pandas
pytestCheckHook
];
pythonImportsCheck = [
"rapidfuzz.fuzz"
"rapidfuzz.string_metric"
"rapidfuzz.process"
"rapidfuzz.utils"
];
meta = with lib; {
description = "Rapid fuzzy string matching";
homepage = "https://github.com/maxbachmann/RapidFuzz";
changelog = "https://github.com/maxbachmann/RapidFuzz/blob/${src.rev}/CHANGELOG.rst";
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
};
}