nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 setuptools,
9 setuptools-scm,
10
11 # dependenices
12 numpy,
13 packaging,
14 pandas,
15
16 # optional-dependencies
17 bottleneck,
18 cartopy,
19 cftime,
20 dask,
21 fsspec,
22 h5netcdf,
23 matplotlib,
24 netcdf4,
25 numba,
26 numbagg,
27 opt-einsum,
28 pooch,
29 scipy,
30 seaborn,
31 sparse,
32 zarr,
33
34 # tests
35 pytest-asyncio,
36 pytestCheckHook,
37}:
38
39buildPythonPackage rec {
40 pname = "xarray";
41 version = "2025.12.0";
42 pyproject = true;
43
44 disabled = pythonOlder "3.11";
45
46 src = fetchFromGitHub {
47 owner = "pydata";
48 repo = "xarray";
49 tag = "v${version}";
50 hash = "sha256-7MTZ/0BbJb3mg2FHvtsV+v4TsgoxD0Tpco7J4DgT/hY=";
51 };
52
53 postPatch = ''
54 # don't depend on pytest-mypy-plugins
55 sed -i "/--mypy-/d" pyproject.toml
56 '';
57
58 build-system = [
59 setuptools
60 setuptools-scm
61 ];
62
63 dependencies = [
64 numpy
65 packaging
66 pandas
67 ];
68
69 optional-dependencies = lib.fix (self: {
70 accel = [
71 bottleneck
72 # flox
73 numba
74 numbagg
75 opt-einsum
76 scipy
77 ];
78 io = [
79 netcdf4
80 h5netcdf
81 # pydap
82 scipy
83 zarr
84 fsspec
85 cftime
86 pooch
87 ];
88 etc = [ sparse ];
89 parallel = [ dask ] ++ dask.optional-dependencies.complete;
90 viz = [
91 cartopy
92 matplotlib
93 # nc-time-axis
94 seaborn
95 ];
96 complete = with self; accel ++ io ++ etc ++ parallel ++ viz;
97 });
98
99 nativeCheckInputs = [
100 pytest-asyncio
101 pytestCheckHook
102 ];
103
104 disabledTestPaths = [
105 "xarray/tests/test_dataarray.py::TestDataArray::test_curvefit_helpers" # Failed: DID NOT RAISE <class 'ValueError'>
106 "xarray/tests/test_duck_array_ops.py::test_extension_array_attr" # NotImplementedError: (CategoricalDtype(categories=['cat1', 'cat2', 'cat3'],...
107 "xarray/tests/test_variable.py::TestIndexVariable::test_concat_periods" # ValueError: Could not convert <xarray.IndexVariable 't' (t: 5)> Size: 40B
108 ];
109
110 pythonImportsCheck = [ "xarray" ];
111
112 meta = {
113 changelog = "https://github.com/pydata/xarray/blob/${src.tag}/doc/whats-new.rst";
114 description = "N-D labeled arrays and datasets in Python";
115 homepage = "https://github.com/pydata/xarray";
116 license = lib.licenses.asl20;
117 maintainers = with lib.maintainers; [
118 doronbehar
119 ];
120 };
121}