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