1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, importlib-metadata
6, joblib
7, llvmlite
8, numba
9, scikit-learn
10, scipy
11, pytestCheckHook
12, pythonOlder
13}:
14
15buildPythonPackage rec {
16 pname = "pynndescent";
17 version = "0.5.8";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.6";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-p8VSVpv2BKEB/VS7odJ8EjieBllF3uOmd3pRjGOkbys=";
25 };
26
27 patches = [
28 # Fix sklearn 1.2.0 compat; https://github.com/lmcinnes/pynndescent/issues/207
29 (fetchpatch {
30 url = "https://github.com/lmcinnes/pynndescent/commit/00444be2107b71169b853847e7b334623c58a4e3.patch";
31 hash = "sha256-mbe01BwroS5q6hENsj3NejmGGhmk2IeX4LD6Iq6PR0c=";
32 })
33 (fetchpatch {
34 url = "https://github.com/lmcinnes/pynndescent/commit/e56b92776a4a05f2dabb80d25479bd37e7ebd88e.patch";
35 hash = "sha256-zVTaW4syGEHh2HAGPyBN3YXqUGe55v/LxKLX/zjXT5Y=";
36 })
37 ];
38
39 propagatedBuildInputs = [
40 joblib
41 llvmlite
42 numba
43 scikit-learn
44 scipy
45 ] ++ lib.optionals (pythonOlder "3.8") [
46 importlib-metadata
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 ];
52
53 disabledTests = [
54 # numpy.core._exceptions._UFuncNoLoopError
55 "test_sparse_nn_descent_query_accuracy_angular"
56 "test_nn_descent_query_accuracy_angular"
57 "test_alternative_distances"
58 # scipy: ValueError: Unknown Distance Metric: wminkowski
59 # https://github.com/scikit-learn/scikit-learn/pull/21741
60 "test_weighted_minkowski"
61 ];
62
63 pythonImportsCheck = [
64 "pynndescent"
65 ];
66
67 meta = with lib; {
68 description = "Nearest Neighbor Descent";
69 homepage = "https://github.com/lmcinnes/pynndescent";
70 license = licenses.bsd2;
71 maintainers = with maintainers; [ mic92 ];
72 };
73}