diff --git a/pkgs/development/python-modules/h5py/default.nix b/pkgs/development/python-modules/h5py/default.nix index b0ab2fc32af4..0adb77a037ef 100644 --- a/pkgs/development/python-modules/h5py/default.nix +++ b/pkgs/development/python-modules/h5py/default.nix @@ -79,6 +79,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "h5py" ]; + passthru = { + # To evaluate more easily *Support flags of it from within Python Packages. + inherit hdf5; + }; + meta = { changelog = "https://github.com/h5py/h5py/blob/${version}/docs/whatsnew/${lib.versions.majorMinor version}.rst"; description = "Pythonic interface to the HDF5 binary data format"; diff --git a/pkgs/development/python-modules/xarray/default.nix b/pkgs/development/python-modules/xarray/default.nix index 823d1bcada2e..6bc6e731ce2b 100644 --- a/pkgs/development/python-modules/xarray/default.nix +++ b/pkgs/development/python-modules/xarray/default.nix @@ -33,18 +33,21 @@ # tests pytest-asyncio, pytestCheckHook, + h5py, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "xarray"; - version = "2026.02.0"; + version = "2026.04.0"; pyproject = true; + # Needed mainly for pytestFlags with spaces + __structuredAttrs = true; src = fetchFromGitHub { owner = "pydata"; repo = "xarray"; - tag = "v${version}"; - hash = "sha256-g1cKI0Et3RToWOxn+bELtT5jAaB8e1N+k9doCU+OgfY="; + tag = "v${finalAttrs.version}"; + hash = "sha256-BsgL+Xo9fTMLLdz5AfScnKGuBa76cE85LuUzB4ZNLiY="; }; postPatch = '' @@ -63,7 +66,7 @@ buildPythonPackage rec { pandas ]; - optional-dependencies = lib.fix (self: { + optional-dependencies = { accel = [ bottleneck # flox @@ -90,25 +93,36 @@ buildPythonPackage rec { # nc-time-axis seaborn ]; - complete = with self; accel ++ io ++ etc ++ parallel ++ viz; - }); + complete = + with finalAttrs.finalPackage.passthru.optional-dependencies; + accel ++ io ++ etc ++ parallel ++ viz; + }; nativeCheckInputs = [ pytest-asyncio pytestCheckHook - scipy - ]; - - disabledTestPaths = [ - # https://github.com/pydata/xarray/issues/11183 - "xarray/tests/test_dataarray.py::TestDataArray::test_curvefit_helpers" # Failed: DID NOT RAISE - "xarray/tests/test_variable.py::TestIndexVariable::test_concat_periods" # ValueError: Could not convert Size: 40B + ] + # Besides scipy, these are not strictly needed for the tests, but adding all + # of these optional-dependencies extends the amount of tests from ~17k to + # ~21k. + ++ finalAttrs.finalPackage.optional-dependencies.io + ++ finalAttrs.finalPackage.optional-dependencies.accel + ++ finalAttrs.finalPackage.optional-dependencies.etc + ++ finalAttrs.finalPackage.optional-dependencies.parallel + # Not adding optional-dependencies.viz because adding cartopy causes infinite + # recursion, and doesn't cause more tests to be collected. + ; + pytestFlags = lib.optionals (!h5py.hdf5.szipSupport) [ + "-k" + # Our h5py is built with hdf5 that is built without szip support, so we + # skip these tests + "not szip" ]; pythonImportsCheck = [ "xarray" ]; meta = { - changelog = "https://github.com/pydata/xarray/blob/${src.tag}/doc/whats-new.rst"; + changelog = "https://github.com/pydata/xarray/blob/${finalAttrs.src.tag}/doc/whats-new.rst"; description = "N-D labeled arrays and datasets in Python"; homepage = "https://github.com/pydata/xarray"; license = lib.licenses.asl20; @@ -116,4 +130,4 @@ buildPythonPackage rec { doronbehar ]; }; -} +})