1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cmake,
6 cython,
7 ninja,
8 scikit-build-core,
9 rapidfuzz-cpp,
10 rapidfuzz,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "levenshtein";
16 version = "0.27.1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "maxbachmann";
21 repo = "Levenshtein";
22 tag = "v${version}";
23 hash = "sha256-EFEyP7eqB4sUQ2ksD67kCr0BEShTiKWbk1PxXOUOGc4=";
24 };
25
26 postPatch = ''
27 substituteInPlace pyproject.toml \
28 --replace-fail "Cython>=3.0.12,<3.1.0" Cython
29 '';
30
31 build-system = [
32 cmake
33 cython
34 ninja
35 scikit-build-core
36 ];
37
38 dontUseCmakeConfigure = true;
39
40 buildInputs = [ rapidfuzz-cpp ];
41
42 dependencies = [ rapidfuzz ];
43
44 nativeCheckInputs = [ pytestCheckHook ];
45
46 pythonImportsCheck = [ "Levenshtein" ];
47
48 meta = {
49 description = "Functions for fast computation of Levenshtein distance and string similarity";
50 homepage = "https://github.com/maxbachmann/Levenshtein";
51 changelog = "https://github.com/maxbachmann/Levenshtein/blob/v${version}/HISTORY.md";
52 license = lib.licenses.gpl2Plus;
53 maintainers = with lib.maintainers; [ fab ];
54 };
55}