1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, keras
6, numba
7, numpy
8, pynndescent
9, pytestCheckHook
10, pythonOlder
11, scikit-learn
12, scipy
13, tensorflow
14, tqdm
15}:
16
17buildPythonPackage rec {
18 pname = "umap-learn";
19 version = "0.5.3";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchFromGitHub {
25 owner = "lmcinnes";
26 repo = "umap";
27 rev = version;
28 hash = "sha256-S2+k7Ec4AxsN6d0GUGnU81oLnBgmlZp8OmUFCNaUJYw=";
29 };
30
31 patches = [
32 # Fix tests with sklearn>=1.2.0
33 (fetchpatch {
34 url = "https://github.com/lmcinnes/umap/commit/a714b59bd9e2ca2e63312bc3491b2b037a42f2f2.patch";
35 hash = "sha256-WOSWNN5ewVTV7IEBEA7ZzgZYMZxctF1jAWs9ylKTyLs=";
36 })
37 (fetchpatch {
38 url = "https://github.com/lmcinnes/umap/commit/c7d05683325589ad432a55e109cacb9d631cfaa9.patch";
39 hash = "sha256-hE2Svxf7Uja+DbCmTDCnd7mZynjNbC5GUjfqg4ZRO9Y=";
40 })
41 (fetchpatch {
42 url = "https://github.com/lmcinnes/umap/commit/949abd082524fce8c45dfb147bcd8e8ef49eade3.patch";
43 hash = "sha256-8/1k8iYeF77FIaUApNtY07auPJkrt3vNRR/HTYRvq+0=";
44 })
45 # Fix tests with numpy>=1.24
46 # https://github.com/lmcinnes/umap/pull/952
47 (fetchpatch {
48 url = "https://github.com/lmcinnes/umap/commit/588e1f724c9f5de528eb1500b0c85a1a609fe947.patch";
49 hash = "sha256-B50eyMs3CRuzOAq+jxz56XMJPdiUofUxCL0Vqolaafo=";
50 })
51 # https://github.com/lmcinnes/umap/pull/1010
52 (fetchpatch {
53 url = "https://github.com/lmcinnes/umap/commit/848396c762c894e666aaf3d0bcfe1e041b529ea6.patch";
54 hash = "sha256-ir0Pxfr2c0oSuFGXQqHjkj7nzvlpTXCYbaI9qAiLun0=";
55 })
56 (fetchpatch {
57 url = "https://github.com/lmcinnes/umap/commit/30e39938f4627f327223245dfe2c908af6b7e304.patch";
58 hash = "sha256-7Divrym05wIPa7evgrNYXGm44/EOWG8sIYV8fmtuzJ4=";
59 })
60 ];
61
62 propagatedBuildInputs = [
63 numba
64 numpy
65 pynndescent
66 scikit-learn
67 scipy
68 tqdm
69 ];
70
71 nativeCheckInputs = [
72 keras
73 pytestCheckHook
74 tensorflow
75 ];
76
77 preCheck = ''
78 export HOME=$TMPDIR
79 '';
80
81 disabledTests = [
82 # Plot functionality requires additional packages.
83 # These test also fail with 'RuntimeError: cannot cache function' error.
84 "test_umap_plot_testability"
85 "test_plot_runs_at_all"
86
87 # Flaky test. Fails with AssertionError sometimes.
88 "test_sparse_hellinger"
89 "test_densmap_trustworthiness_on_iris_supervised"
90
91 # tensorflow maybe incompatible? https://github.com/lmcinnes/umap/issues/821
92 "test_save_load"
93 ];
94
95 meta = with lib; {
96 description = "Uniform Manifold Approximation and Projection";
97 homepage = "https://github.com/lmcinnes/umap";
98 license = licenses.bsd3;
99 maintainers = with maintainers; [ costrouc ];
100 };
101}