1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatch-vcs,
6 hatchling,
7 anndata,
8 h5py,
9 joblib,
10 legacy-api-wrap,
11 matplotlib,
12 natsort,
13 networkx,
14 numba,
15 numpy,
16 packaging,
17 pandas,
18 patsy,
19 pynndescent,
20 scikit-learn,
21 scipy,
22 seaborn,
23 session-info2,
24 statsmodels,
25 tqdm,
26 typing-extensions,
27 umap-learn,
28 dask,
29 dask-ml,
30
31 igraph,
32 leidenalg,
33 scikit-image,
34 scikit-misc,
35 zarr,
36 pytestCheckHook,
37 pytest-cov-stub,
38 pytest-mock,
39 pytest-randomly,
40 pytest-rerunfailures,
41 pytest-xdist,
42 tuna,
43}:
44
45buildPythonPackage rec {
46 pname = "scanpy";
47 version = "1.11.4";
48 pyproject = true;
49
50 src = fetchFromGitHub {
51 owner = "scverse";
52 repo = "scanpy";
53 tag = version;
54 hash = "sha256-EvNelorfLOpYLGGZ1RSq4+jk6emuCWCKBdUop24iLf4=";
55 };
56
57 build-system = [
58 hatch-vcs
59 hatchling
60 ];
61
62 dependencies = [
63 anndata
64 h5py
65 joblib
66 legacy-api-wrap
67 matplotlib
68 natsort
69 networkx
70 numba
71 numpy
72 packaging
73 pandas
74 patsy
75 pynndescent
76 scikit-learn
77 scipy
78 seaborn
79 session-info2
80 statsmodels
81 tqdm
82 typing-extensions
83 umap-learn
84 ];
85
86 optional-dependencies = {
87 # commented attributes are due to some dependencies not being in Nixpkgs
88 #bbknn = [
89 # bbknn
90 #];
91 dask = [
92 anndata
93 dask
94 ];
95 dask-ml = [
96 dask-ml
97 ];
98 #harmony = [
99 # harmonypy
100 #];
101 leiden = [
102 igraph
103 leidenalg
104 ];
105 #louvain = [
106 # igraph
107 # louvain
108 #];
109 #magic = [
110 # magic-impute
111 #];
112 paga = [
113 igraph
114 ];
115 #rapids = [
116 # cudf
117 # cugraph
118 # cuml
119 #];
120 #scanorama = [
121 # scanorama
122 #];
123 scrublet = [
124 scikit-image
125 ];
126 skmisc = [
127 scikit-misc
128 ];
129 };
130
131 nativeCheckInputs = [
132 pytestCheckHook
133 pytest-cov-stub
134 pytest-mock
135 pytest-randomly
136 pytest-rerunfailures
137 pytest-xdist
138 tuna
139 zarr
140 ];
141
142 preCheck = ''
143 export NUMBA_CACHE_DIR=$(mktemp -d);
144 '';
145
146 disabledTestPaths = [
147 # try to download data:
148 "tests/test_aggregated.py"
149 "tests/test_highly_variable_genes.py"
150 "tests/test_normalization.py"
151 "tests/test_pca.py"
152 "tests/test_plotting.py"
153 "tests/test_plotting_embedded/"
154 ];
155
156 disabledTests = [
157 # try to download data:
158 "scanpy.get._aggregated.aggregate"
159 "scanpy.plotting._tools.scatterplots.spatial"
160 "test_clip"
161 "test_download_failure"
162 "test_mean_var"
163 "test_regress_out_int"
164 "test_score_with_reference"
165
166 # fails to find the trivial test script for some reason:
167 "test_external"
168
169 # AssertionError: Not equal to tolerance rtol=1e-07, atol=0
170 "test_connectivities_euclidean"
171 ];
172
173 pythonImportsCheck = [
174 "scanpy"
175 ];
176
177 meta = {
178 description = "Single-cell analysis in Python which scales to >100M cells";
179 homepage = "https://scanpy.readthedocs.io";
180 changelog = "https://github.com/scverse/scanpy/releases/tag/${src.tag}";
181 license = lib.licenses.bsd3;
182 maintainers = with lib.maintainers; [ bcdarwin ];
183 mainProgram = "scanpy";
184 };
185}