1{
2 lib,
3 buildPythonPackage,
4 cmake,
5 cython,
6 fetchFromGitHub,
7 ninja,
8 pytestCheckHook,
9 pythonOlder,
10 rapidfuzz,
11 rapidfuzz-cpp,
12 scikit-build-core,
13}:
14
15buildPythonPackage rec {
16 pname = "levenshtein";
17 version = "0.26.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.9";
21
22 src = fetchFromGitHub {
23 owner = "maxbachmann";
24 repo = "Levenshtein";
25 rev = "refs/tags/v${version}";
26 hash = "sha256-uLOOAmJ8Y0z+tuIIOSnI8qZoZ+IA2+tNBX1lDCvc8+A=";
27 fetchSubmodules = true; # # for vendored `rapidfuzz-cpp`
28 };
29
30 build-system = [
31 cmake
32 cython
33 ninja
34 scikit-build-core
35 ];
36
37 dontUseCmakeConfigure = true;
38
39 buildInputs = [ rapidfuzz-cpp ];
40
41 dependencies = [ rapidfuzz ];
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 pythonImportsCheck = [ "Levenshtein" ];
46
47 meta = with lib; {
48 description = "Functions for fast computation of Levenshtein distance and string similarity";
49 homepage = "https://github.com/maxbachmann/Levenshtein";
50 changelog = "https://github.com/maxbachmann/Levenshtein/blob/${src.rev}/HISTORY.md";
51 license = licenses.gpl2Plus;
52 maintainers = with maintainers; [ fab ];
53 };
54}