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.10";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.6";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-XV3Gg8A+9V/j3faThZcgyhj4XG5uW7C08UhwJ41SiK0=";
25 };
26
27 patches = [
28 # https://github.com/lmcinnes/pynndescent/pull/224
29 (fetchpatch {
30 url = "https://github.com/lmcinnes/pynndescent/commit/86e0d716a3a4d5f4e6a0a3c2952f6fe339524e96.patch";
31 hash = "sha256-dfnT5P9Qsn/nSAr4Ysqo/olbLLfoZXvBRz33yzhN3J4=";
32 })
33 ];
34
35 propagatedBuildInputs = [
36 joblib
37 llvmlite
38 numba
39 scikit-learn
40 scipy
41 ] ++ lib.optionals (pythonOlder "3.8") [
42 importlib-metadata
43 ];
44
45 nativeCheckInputs = [
46 pytestCheckHook
47 ];
48
49 disabledTests = [
50 # numpy.core._exceptions._UFuncNoLoopError
51 "test_sparse_nn_descent_query_accuracy_angular"
52 "test_nn_descent_query_accuracy_angular"
53 "test_alternative_distances"
54 # scipy: ValueError: Unknown Distance Metric: wminkowski
55 # https://github.com/scikit-learn/scikit-learn/pull/21741
56 "test_weighted_minkowski"
57 ];
58
59 pythonImportsCheck = [
60 "pynndescent"
61 ];
62
63 meta = with lib; {
64 description = "Nearest Neighbor Descent";
65 homepage = "https://github.com/lmcinnes/pynndescent";
66 license = licenses.bsd2;
67 maintainers = with maintainers; [ mic92 ];
68 };
69}