diff --git a/ci/install-upstream-wheels.sh b/ci/install-upstream-wheels.sh index 02d36259f82..f5cbaa0729b 100755 --- a/ci/install-upstream-wheels.sh +++ b/ci/install-upstream-wheels.sh @@ -53,7 +53,7 @@ python -m pip install \ git+https://github.com/dask/dask \ git+https://github.com/dask/dask-expr \ git+https://github.com/dask/distributed \ - git+https://github.com/zarr-developers/zarr-python \ + git+https://github.com/zarr-developers/zarr-python.git@main \ git+https://github.com/Unidata/cftime \ git+https://github.com/pypa/packaging \ git+https://github.com/hgrecco/pint \ diff --git a/pyproject.toml b/pyproject.toml index 8cfbb6851b3..60d5a5f93a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,9 +38,9 @@ complete = ["xarray[accel,etc,io,parallel,viz]"] io = [ "netCDF4>=1.6.0", "h5netcdf", - "pydap", "scipy>=1.13", - "zarr>=2.18", + 'pydap', + "zarr @ git+https://github.com/d-v-b/zarr-python.git@feat/fixed-length-strings", "fsspec", "cftime", "pooch", diff --git a/xarray/backends/zarr.py b/xarray/backends/zarr.py index 48405b906cd..cbe9855b8e0 100644 --- a/xarray/backends/zarr.py +++ b/xarray/backends/zarr.py @@ -36,7 +36,6 @@ from xarray.core.variable import Variable from xarray.namedarray.parallelcompat import guess_chunkmanager from xarray.namedarray.pycompat import integer_types -from xarray.namedarray.utils import module_available if TYPE_CHECKING: from xarray.backends.common import AbstractDataStore @@ -106,7 +105,14 @@ def _choose_default_mode( def _zarr_v3() -> bool: - return module_available("zarr", minversion="3") + # don't use the module_available function because it doesn't report zarr v3 correctly. + try: + import zarr + from packaging.version import Version + + return Version(zarr.__version__).major == 3 + except ImportError: + return False # need some special secret attributes to tell us the dimensions diff --git a/xarray/namedarray/utils.py b/xarray/namedarray/utils.py index 96060730345..9e1e6e7cb7d 100644 --- a/xarray/namedarray/utils.py +++ b/xarray/namedarray/utils.py @@ -51,7 +51,6 @@ def module_available(module: str, minversion: str | None = None) -> bool: """ if importlib.util.find_spec(module) is None: return False - if minversion is not None: version = importlib.metadata.version(module)