1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, cmake
6, ninja
7, cython
8, rapidfuzz-capi
9, scikit-build
10, setuptools
11, wheel
12, jarowinkler-cpp
13, hypothesis
14, pytestCheckHook
15}:
16
17buildPythonPackage rec {
18 pname = "jarowinkler";
19 version = "1.2.3";
20 format = "pyproject";
21
22 disabled = pythonOlder "3.6";
23
24 src = fetchFromGitHub {
25 owner = "maxbachmann";
26 repo = "JaroWinkler";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-j+ZabVsiVitNkTPhGjDg72XogjvPaL453lTW45ITm90=";
29 };
30
31 # We cannot use Cython version 3.0.0 because the code in jarowinkler has not
32 # been adapted for https://github.com/cython/cython/issues/4280 yet
33 postPatch = ''
34 substituteInPlace pyproject.toml \
35 --replace 'scikit-build==' 'scikit-build>=' \
36 --replace 'Cython==3.0.0a11' 'Cython'
37 '';
38
39 nativeBuildInputs = [
40 cmake
41 cython
42 ninja
43 rapidfuzz-capi
44 scikit-build
45 setuptools
46 wheel
47 ];
48
49 buildInputs = [
50 jarowinkler-cpp
51 ];
52
53 preBuild = ''
54 export JAROWINKLER_BUILD_EXTENSION=1
55 '';
56
57 dontUseCmakeConfigure = true;
58
59 nativeCheckInputs = [
60 hypothesis
61 pytestCheckHook
62 ];
63
64 pythonImportsCheck = [ "jarowinkler" ];
65
66 meta = with lib; {
67 description = "Library for fast approximate string matching using Jaro and Jaro-Winkler similarity";
68 homepage = "https://github.com/maxbachmann/JaroWinkler";
69 changelog = "https://github.com/maxbachmann/JaroWinkler/blob/${src.rev}/CHANGELOG.md";
70 license = licenses.mit;
71 maintainers = with maintainers; [ dotlambda ];
72 };
73}