diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e09975e444..d32f6f793c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,14 +44,19 @@ jobs: run: | hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run - upstream: - name: py=${{ matrix.python-version }}-upstream + test-upstream-and-min-deps: + name: py=${{ matrix.python-version }}-${{ matrix.dependency-set }} runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.13'] - + python-version: ['3.11', "3.13"] + dependency-set: ["upstream", "min_deps"] + exclude: + - python-version: "3.13" + dependency-set: min_deps + - python-version: "3.11" + dependency-set: upstream steps: - uses: actions/checkout@v4 - name: Set up Python @@ -65,8 +70,8 @@ jobs: pip install hatch - name: Set Up Hatch Env run: | - hatch env create upstream - hatch env run -e upstream list-env + hatch env create ${{ matrix.dependency-set }} + hatch env run -e ${{ matrix.dependency-set }} list-env - name: Run Tests run: | - hatch env run --env upstream run + hatch env run --env ${{ matrix.dependency-set }} run diff --git a/pyproject.toml b/pyproject.toml index e3d8a310b1..ef2ccd9469 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,12 +28,13 @@ requires-python = ">=3.11" dependencies = [ 'asciitree', 'numpy>=1.25', - 'numcodecs>=0.10.2', - 'fsspec>2024', - 'crc32c', - 'typing_extensions', - 'donfig', + 'numcodecs>=0.13', + 'fsspec>=2022.10.0', + 'crc32c>=2.3', + 'typing_extensions>=4.6', + 'donfig>=0.8', ] + dynamic = [ "version", ] @@ -98,7 +99,7 @@ extra = [ ] optional = [ 'lmdb', - 'universal-pathlib', + 'universal-pathlib>=0.0.22', ] [project.urls] @@ -184,6 +185,7 @@ build = "cd docs && make html" serve = "sphinx-autobuild docs docs/_build --host 0.0.0.0" [tool.hatch.envs.upstream] +python = "3.13" dependencies = [ 'numpy', # from scientific-python-nightly-wheels 'numcodecs @ git+https://github.com/zarr-developers/numcodecs', @@ -212,6 +214,35 @@ run-mypy = "mypy src" run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*" list-env = "pip list" +[tool.hatch.envs.min_deps] +description = """Test environment for minimum supported dependencies + +See Spec 0000 for details and drop schedule: https://scientific-python.org/specs/spec-0000/ +""" +python = "3.11" +dependencies = [ + 'numpy==1.25.*', + 'numcodecs==0.13.*', # 0.13 needed for? (should be 0.11) + 'fsspec==2022.10.0', + 's3fs==2022.10.0', + 'universal_pathlib==0.0.22', + 'crc32c==2.3.*', + 'typing_extensions==4.6.*', # 4.5 needed for @deprecated, 4.6 for Buffer + 'donfig==0.8.*', + # test deps + 'hypothesis', + 'pytest', + 'pytest-cov', + 'pytest-asyncio', + 'moto[s3]', +] + +[tool.hatch.envs.min_deps.scripts] +run = "pytest --verbose" +run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*" +list-env = "pip list" + + [tool.ruff] line-length = 100 force-exclude = true diff --git a/src/zarr/storage/remote.py b/src/zarr/storage/remote.py index 0a0ec7f7cc..812b1e24f9 100644 --- a/src/zarr/storage/remote.py +++ b/src/zarr/storage/remote.py @@ -2,8 +2,6 @@ from typing import TYPE_CHECKING, Any, Self -import fsspec - from zarr.abc.store import ByteRangeRequest, Store from zarr.storage.common import _dereference_path @@ -130,7 +128,13 @@ def from_url( ------- RemoteStore """ - fs, path = fsspec.url_to_fs(url, **storage_options) + try: + from fsspec import url_to_fs + except ImportError: + # before fsspec==2024.3.1 + from fsspec.core import url_to_fs + + fs, path = url_to_fs(url, **storage_options) return cls(fs=fs, path=path, mode=mode, allowed_exceptions=allowed_exceptions) async def clear(self) -> None: