1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
cmake,
cython,
ninja,
scikit-build-core,
numpy,
hypothesis,
pandas,
pytestCheckHook,
rapidfuzz-cpp,
taskflow,
}:
buildPythonPackage rec {
pname = "rapidfuzz";
version = "3.14.3";
pyproject = true;
src = fetchFromGitHub {
owner = "maxbachmann";
repo = "RapidFuzz";
tag = "v${version}";
hash = "sha256-DOXeZaD21Qsum4brBlMSFcBAUbNEOgCXc6AqEboP1e4=";
};
patches = [
# https://github.com/rapidfuzz/RapidFuzz/pull/463
(fetchpatch {
name = "support-taskflow-3.11.0.patch";
url = "https://github.com/rapidfuzz/RapidFuzz/commit/0ef2a4980c41b852283e6db7a747a1632307c75e.patch";
hash = "sha256-xb+J3PXwD51lZqIJcTzPJWrT/oqrIXxh1cLp91DhIPg=";
})
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "Cython >=3.1.6, <3.2.0" "Cython >=3.1.6"
'';
build-system = [
cmake
cython
ninja
scikit-build-core
];
dontUseCmakeConfigure = true;
buildInputs = [
rapidfuzz-cpp
taskflow
];
env.RAPIDFUZZ_BUILD_EXTENSION = 1;
preBuild = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
export CMAKE_ARGS="-DCMAKE_CXX_COMPILER_AR=$AR -DCMAKE_CXX_COMPILER_RANLIB=$RANLIB"
'';
optional-dependencies = {
all = [ numpy ];
};
preCheck = ''
export RAPIDFUZZ_IMPLEMENTATION=cpp
'';
nativeCheckInputs = [
hypothesis
pandas
pytestCheckHook
];
pythonImportsCheck = [
"rapidfuzz.distance"
"rapidfuzz.fuzz"
"rapidfuzz.process"
"rapidfuzz.utils"
];
meta = {
description = "Rapid fuzzy string matching";
homepage = "https://github.com/maxbachmann/RapidFuzz";
changelog = "https://github.com/maxbachmann/RapidFuzz/blob/${src.tag}/CHANGELOG.rst";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ dotlambda ];
};
}
|