Skip to content

Commit

Permalink
test(ci): Add CI for minimum supported dependency versions (#2423)
Browse files Browse the repository at this point in the history
* test(ci): add test environment for upstream dependencies

* try PIP_INDEX_URL again

* test(ci): add test environment for oldest supported dependency versions

* use a matrix again
  • Loading branch information
jhamman authored Oct 21, 2024
1 parent 4a18c5a commit a9d6d74
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 16 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
43 changes: 37 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down Expand Up @@ -98,7 +99,7 @@ extra = [
]
optional = [
'lmdb',
'universal-pathlib',
'universal-pathlib>=0.0.22',
]

[project.urls]
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/zarr/storage/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a9d6d74

Please sign in to comment.