1{
2 anndata,
3 array-api-compat,
4 awkward,
5 boltons,
6 buildPythonPackage,
7 dask,
8 distributed,
9 fetchFromGitHub,
10 filelock,
11 h5py,
12 hatch-vcs,
13 hatchling,
14 joblib,
15 lib,
16 legacy-api-wrap,
17 natsort,
18 numba,
19 numpy,
20 openpyxl,
21 pandas,
22 pyarrow,
23 pytest-mock,
24 pytest-xdist,
25 pytestCheckHook,
26 scanpy,
27 scikit-learn,
28 scipy,
29 stdenv,
30 zarr,
31}:
32
33buildPythonPackage rec {
34 pname = "anndata";
35 version = "0.12.2";
36 pyproject = true;
37
38 src = fetchFromGitHub {
39 owner = "scverse";
40 repo = "anndata";
41 tag = version;
42 hash = "sha256-uGkeSlYcphRnIFfe9UcLvnupKeMzAIm5wT8fp3gmPKw=";
43 };
44
45 build-system = [
46 hatch-vcs
47 hatchling
48 ];
49
50 dependencies = [
51 array-api-compat
52 h5py
53 legacy-api-wrap
54 natsort
55 numpy
56 pandas
57 scipy
58 zarr
59 ];
60
61 nativeCheckInputs = [
62 awkward
63 boltons
64 dask
65 distributed
66 filelock
67 joblib
68 numba
69 openpyxl
70 pyarrow
71 pytest-mock
72 pytest-xdist
73 pytestCheckHook
74 scikit-learn
75 scanpy
76 ];
77
78 # Optionally disable pytest-xdist to make it easier to debug the test suite.
79 # Test suite takes ~5 minutes without pytest-xdist. Note that some tests will
80 # fail when running without pytest-xdist ("worker_id not found").
81 # pytestFlags = [ "-oaddopts=" ];
82
83 preCheck = ''
84 export NUMBA_CACHE_DIR=$(mktemp -d);
85 '';
86
87 doCheck = false; # use passthru.tests instead to prevent circularity with `scanpy`
88
89 passthru.tests = anndata.overridePythonAttrs { doCheck = true; };
90
91 disabledTests = [
92 # requires data from a previous test execution:
93 "test_no_diff"
94
95 # try to download data:
96 "anndata._io.specs.registry.read_elem_lazy"
97 "anndata.experimental.merge.concat_on_disk"
98 "anndata.experimental.multi_files._anncollection.AnnCollection"
99
100 # Tests that require cupy and GPU access. Introducing cupy as a dependency
101 # would make this package unfree and GPU access is not possible within the
102 # nix build environment anyhow.
103 "test_adata_raw_gpu"
104 "test_as_cupy_dask"
105 "test_as_dask_functions"
106 "test_concat_different_types_dask"
107 "test_concat_on_var_outer_join"
108 "test_concatenate_layers_misaligned"
109 "test_concatenate_layers_outer"
110 "test_concatenate_layers"
111 "test_concatenate_roundtrip"
112 "test_dask_to_memory_unbacked"
113 "test_ellipsis_index"
114 "test_error_on_mixed_device"
115 "test_gpu"
116 "test_io_spec_cupy"
117 "test_modify_view_component"
118 "test_nan_merge"
119 "test_pairwise_concat"
120 "test_raw_gpu"
121 "test_set_scalar_subset_X"
122 "test_transposed_concat"
123 "test_view_different_type_indices"
124 "test_view_of_view"
125
126 # Tests that are seemingly broken. See https://github.com/scverse/anndata/issues/2017.
127 "test_concat_dask_sparse_matches_memory"
128 ]
129 ++ lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [
130 # RuntimeError: Cluster failed to start: [Errno 1] Operation not permitted
131 "test_dask_distributed_write"
132 "test_read_lazy_h5_cluster"
133 ];
134
135 pythonImportsCheck = [ "anndata" ];
136
137 meta = {
138 changelog = "https://github.com/scverse/anndata/blob/main/docs/release-notes/${version}.md";
139 description = "Python package for handling annotated data matrices in memory and on disk";
140 homepage = "https://anndata.readthedocs.io/";
141 license = lib.licenses.bsd3;
142 maintainers = with lib.maintainers; [ samuela ];
143 };
144}