Skip to content

Commit 08c924d

Browse files
authored
Merge branch 'main' into v2-codec
2 parents c608fef + bc588a7 commit 08c924d

32 files changed

+789
-329
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,35 @@ jobs:
4343
- name: Run Tests
4444
run: |
4545
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run
46+
47+
test-upstream-and-min-deps:
48+
name: py=${{ matrix.python-version }}-${{ matrix.dependency-set }}
49+
50+
runs-on: ubuntu-latest
51+
strategy:
52+
matrix:
53+
python-version: ['3.11', "3.13"]
54+
dependency-set: ["upstream", "min_deps"]
55+
exclude:
56+
- python-version: "3.13"
57+
dependency-set: min_deps
58+
- python-version: "3.11"
59+
dependency-set: upstream
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Set up Python
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: ${{ matrix.python-version }}
66+
cache: 'pip'
67+
- name: Install Hatch
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install hatch
71+
- name: Set Up Hatch Env
72+
run: |
73+
hatch env create ${{ matrix.dependency-set }}
74+
hatch env run -e ${{ matrix.dependency-set }} list-env
75+
- name: Run Tests
76+
run: |
77+
hatch env run --env ${{ matrix.dependency-set }} run

.pep8speaks.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default_language_version:
77
python: python3
88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.6.9
10+
rev: v0.7.0
1111
hooks:
1212
- id: ruff
1313
args: ["--fix", "--show-fixes"]
@@ -22,7 +22,7 @@ repos:
2222
hooks:
2323
- id: check-yaml
2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.11.2
25+
rev: v1.12.1
2626
hooks:
2727
- id: mypy
2828
files: src|tests

docs/guide/storage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ that implements the `AbstractFileSystem` API,
7272
.. code-block:: python
7373
7474
>>> import zarr
75-
>>> store = zarr.storage.RemoteStore("gs://foo/bar", mode="r")
75+
>>> store = zarr.storage.RemoteStore.from_url("gs://foo/bar", mode="r")
7676
>>> zarr.open(store=store)
7777
<Array <RemoteStore(GCSFileSystem, foo/bar)> shape=(10, 20) dtype=float32>
7878

pyproject.toml

Lines changed: 79 additions & 7 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]
@@ -183,6 +184,65 @@ features = ['docs']
183184
build = "cd docs && make html"
184185
serve = "sphinx-autobuild docs docs/_build --host 0.0.0.0"
185186

187+
[tool.hatch.envs.upstream]
188+
python = "3.13"
189+
dependencies = [
190+
'numpy', # from scientific-python-nightly-wheels
191+
'numcodecs @ git+https://github.com/zarr-developers/numcodecs',
192+
'fsspec @ git+https://github.com/fsspec/filesystem_spec',
193+
's3fs @ git+https://github.com/fsspec/s3fs',
194+
'universal_pathlib @ git+https://github.com/fsspec/universal_pathlib',
195+
'crc32c @ git+https://github.com/ICRAR/crc32c',
196+
'typing_extensions @ git+https://github.com/python/typing_extensions',
197+
'donfig @ git+https://github.com/pytroll/donfig',
198+
# test deps
199+
'hypothesis',
200+
'pytest',
201+
'pytest-cov',
202+
'pytest-asyncio',
203+
'moto[s3]',
204+
]
205+
206+
[tool.hatch.envs.upstream.env-vars]
207+
PIP_INDEX_URL = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
208+
PIP_EXTRA_INDEX_URL = "https://pypi.org/simple/"
209+
PIP_PRE = "1"
210+
211+
[tool.hatch.envs.upstream.scripts]
212+
run = "pytest --verbose"
213+
run-mypy = "mypy src"
214+
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
215+
list-env = "pip list"
216+
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+
186246
[tool.ruff]
187247
line-length = 100
188248
force-exclude = true
@@ -214,6 +274,7 @@ extend-select = [
214274
"B", # flake8-bugbear
215275
"C4", # flake8-comprehensions
216276
"FLY", # flynt
277+
"FURB", # refurb
217278
"G", # flake8-logging-format
218279
"I", # isort
219280
"ISC", # flake8-implicit-str-concat
@@ -329,4 +390,15 @@ ignore = [
329390

330391
[tool.numpydoc_validation]
331392
# See https://numpydoc.readthedocs.io/en/latest/validation.html#built-in-validation-checks for list of checks
332-
checks = ["GL06", "GL07", "GL10", "PR03", "PR05", "PR06"]
393+
checks = [
394+
"GL06",
395+
"GL07",
396+
"GL09",
397+
"GL10",
398+
"SS02",
399+
"SS04",
400+
"PR02",
401+
"PR03",
402+
"PR05",
403+
"PR06",
404+
]

src/zarr/abc/codec.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
8585
8686
Parameters
8787
----------
88-
chunk_spec : ArraySpec
88+
array_spec : ArraySpec
8989
9090
Returns
9191
-------
@@ -99,11 +99,11 @@ def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: Chun
9999
100100
Parameters
101101
----------
102-
shape: ChunkCoords
102+
shape : ChunkCoords
103103
The array shape
104-
dtype: np.dtype[Any]
104+
dtype : np.dtype[Any]
105105
The array data type
106-
chunk_grid: ChunkGrid
106+
chunk_grid : ChunkGrid
107107
The array chunk grid
108108
"""
109109
...
@@ -292,11 +292,11 @@ def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: Chun
292292
293293
Parameters
294294
----------
295-
shape: ChunkCoords
295+
shape : ChunkCoords
296296
The array shape
297-
dtype: np.dtype[Any]
297+
dtype : np.dtype[Any]
298298
The array data type
299-
chunk_grid: ChunkGrid
299+
chunk_grid : ChunkGrid
300300
The array chunk grid
301301
"""
302302
...
@@ -308,7 +308,7 @@ def compute_encoded_size(self, byte_length: int, array_spec: ArraySpec) -> int:
308308
309309
Parameters
310310
----------
311-
input_byte_length : int
311+
byte_length : int
312312
array_spec : ArraySpec
313313
314314
Returns
@@ -327,7 +327,7 @@ async def decode(
327327
328328
Parameters
329329
----------
330-
chunks_and_specs : Iterable[tuple[Buffer | None, ArraySpec]]
330+
chunk_bytes_and_specs : Iterable[tuple[Buffer | None, ArraySpec]]
331331
Ordered set of encoded chunks with their accompanying chunk spec.
332332
333333
Returns
@@ -346,7 +346,7 @@ async def encode(
346346
347347
Parameters
348348
----------
349-
chunks_and_specs : Iterable[tuple[NDBuffer | None, ArraySpec]]
349+
chunk_arrays_and_specs : Iterable[tuple[NDBuffer | None, ArraySpec]]
350350
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
351351
352352
Returns

src/zarr/abc/store.py

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

33
from abc import ABC, abstractmethod
44
from asyncio import gather
5+
from itertools import starmap
56
from typing import TYPE_CHECKING, NamedTuple, Protocol, runtime_checkable
67

78
if TYPE_CHECKING:
@@ -162,12 +163,12 @@ def with_mode(self, mode: AccessModeLiteral) -> Self:
162163
163164
Parameters
164165
----------
165-
mode: AccessModeLiteral
166+
mode : AccessModeLiteral
166167
The new mode to use.
167168
168169
Returns
169170
-------
170-
store:
171+
store
171172
A new store of the same type with the new mode.
172173
173174
Examples
@@ -282,7 +283,7 @@ async def _set_many(self, values: Iterable[tuple[str, Buffer]]) -> None:
282283
"""
283284
Insert multiple (key, value) pairs into storage.
284285
"""
285-
await gather(*(self.set(key, value) for key, value in values))
286+
await gather(*starmap(self.set, values))
286287
return
287288

288289
@property

0 commit comments

Comments
 (0)