Skip to content

Commit 163de4d

Browse files
committed
test(ci): add test environment for oldest supported dependency versions
1 parent a8f60df commit 163de4d

File tree

3 files changed

+71
-9
lines changed

3 files changed

+71
-9
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,30 @@ jobs:
7070
- name: Run Tests
7171
run: |
7272
hatch env run --env upstream run
73+
74+
min_deps:
75+
name: py=${{ matrix.python-version }}-min_deps
76+
77+
runs-on: ubuntu-latest
78+
strategy:
79+
matrix:
80+
python-version: ['3.11']
81+
82+
steps:
83+
- uses: actions/checkout@v4
84+
- name: Set up Python
85+
uses: actions/setup-python@v5
86+
with:
87+
python-version: ${{ matrix.python-version }}
88+
cache: 'pip'
89+
- name: Install Hatch
90+
run: |
91+
python -m pip install --upgrade pip
92+
pip install hatch
93+
- name: Set Up Hatch Env
94+
run: |
95+
hatch env create min_deps
96+
hatch env run -e min_deps list-env
97+
- name: Run Tests
98+
run: |
99+
hatch env run --env min_deps run

pyproject.toml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ requires-python = ">=3.11"
2828
dependencies = [
2929
'asciitree',
3030
'numpy>=1.25',
31-
'numcodecs>=0.10.2',
32-
'fsspec>2024',
33-
'crc32c',
34-
'typing_extensions',
35-
'donfig',
31+
'numcodecs>=0.13',
32+
'fsspec>=2022.10.0',
33+
'crc32c>=2.3',
34+
'typing_extensions>=4.6',
35+
'donfig>=0.8',
3636
]
37+
3738
dynamic = [
3839
"version",
3940
]
@@ -98,7 +99,7 @@ extra = [
9899
]
99100
optional = [
100101
'lmdb',
101-
'universal-pathlib',
102+
'universal-pathlib>=0.0.22',
102103
]
103104

104105
[project.urls]
@@ -184,6 +185,7 @@ build = "cd docs && make html"
184185
serve = "sphinx-autobuild docs docs/_build --host 0.0.0.0"
185186

186187
[tool.hatch.envs.upstream]
188+
python = "3.13"
187189
dependencies = [
188190
'numpy', # from scientific-python-nightly-wheels
189191
'numcodecs @ git+https://github.com/zarr-developers/numcodecs',
@@ -212,6 +214,35 @@ run-mypy = "mypy src"
212214
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
213215
list-env = "pip list"
214216

217+
[tool.hatch.envs.min_deps]
218+
description = """Test environment for minimum supported dependencies
219+
220+
See Spec 0000 for details and drop schedule: https://scientific-python.org/specs/spec-0000/
221+
"""
222+
python = "3.11"
223+
dependencies = [
224+
'numpy==1.25.*',
225+
'numcodecs==0.13.*', # 0.13 needed for? (should be 0.11)
226+
'fsspec==2022.10.0',
227+
's3fs==2022.10.0',
228+
'universal_pathlib==0.0.22',
229+
'crc32c==2.3.*',
230+
'typing_extensions==4.6.*', # 4.5 needed for @deprecated, 4.6 for Buffer
231+
'donfig==0.8.*',
232+
# test deps
233+
'hypothesis',
234+
'pytest',
235+
'pytest-cov',
236+
'pytest-asyncio',
237+
'moto[s3]',
238+
]
239+
240+
[tool.hatch.envs.min_deps.scripts]
241+
run = "pytest --verbose"
242+
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
243+
list-env = "pip list"
244+
245+
215246
[tool.ruff]
216247
line-length = 100
217248
force-exclude = true

src/zarr/storage/remote.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from typing import TYPE_CHECKING, Any, Self
44

5-
import fsspec
6-
75
from zarr.abc.store import ByteRangeRequest, Store
86
from zarr.storage.common import _dereference_path
97

@@ -130,7 +128,13 @@ def from_url(
130128
-------
131129
RemoteStore
132130
"""
133-
fs, path = fsspec.url_to_fs(url, **storage_options)
131+
try:
132+
from fsspec import url_to_fs
133+
except ImportError:
134+
# before fsspec==2024.3.1
135+
from fsspec.core import url_to_fs
136+
137+
fs, path = url_to_fs(url, **storage_options)
134138
return cls(fs=fs, path=path, mode=mode, allowed_exceptions=allowed_exceptions)
135139

136140
async def clear(self) -> None:

0 commit comments

Comments
 (0)