Skip to content

Commit 5a262e0

Browse files
authored
Merge branch 'main' into fix/remote-store-path
2 parents 0b585df + 435073c commit 5a262e0

File tree

16 files changed

+311
-148
lines changed

16 files changed

+311
-148
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
python-version: ['3.11', '3.12']
24+
python-version: ['3.11', '3.12', '3.13']
2525
numpy-version: ['1.25', '1.26', '2.0']
2626
dependency-set: ["minimal", "optional"]
2727

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ repos:
3131
- asciitree
3232
- crc32c
3333
- donfig
34-
- fasteners
3534
- numcodecs
3635
- numpy
3736
- typing_extensions

pyproject.toml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ maintainers = [
1818
{ name = "Juan Nunez-Iglesias", email = "[email protected]" },
1919
{ name = "Martin Durant", email = "[email protected]" },
2020
{ name = "Norman Rzepka" },
21-
{ name = "Ryan Abernathey" }
21+
{ name = "Ryan Abernathey" },
22+
{ name = "David Stansby" },
23+
{ name = "Tom Augspurger", email = "[email protected]" },
24+
{ name = "Deepak Cherian" }
2225
]
2326
requires-python = ">=3.11"
2427
# If you add a new dependency here, please also add it to .pre-commit-config.yml
2528
dependencies = [
2629
'asciitree',
2730
'numpy>=1.25',
28-
'fasteners',
2931
'numcodecs>=0.10.2',
3032
'fsspec>2024',
3133
'crc32c',
@@ -47,6 +49,7 @@ classifiers = [
4749
'Programming Language :: Python :: 3',
4850
'Programming Language :: Python :: 3.11',
4951
'Programming Language :: Python :: 3.12',
52+
'Programming Language :: Python :: 3.13',
5053
]
5154
license = {text = "MIT License"}
5255
keywords = ["Python", "compressed", "ndimensional-arrays", "zarr"]
@@ -130,17 +133,17 @@ dependencies = [
130133
features = ["test", "extra"]
131134

132135
[[tool.hatch.envs.test.matrix]]
133-
python = ["3.11", "3.12"]
136+
python = ["3.11", "3.12", "3.13"]
134137
numpy = ["1.25", "1.26", "2.0"]
135138
version = ["minimal"]
136139

137140
[[tool.hatch.envs.test.matrix]]
138-
python = ["3.11", "3.12"]
141+
python = ["3.11", "3.12", "3.13"]
139142
numpy = ["1.25", "1.26", "2.0"]
140143
features = ["optional"]
141144

142145
[[tool.hatch.envs.test.matrix]]
143-
python = ["3.11", "3.12"]
146+
python = ["3.11", "3.12", "3.13"]
144147
numpy = ["1.25", "1.26", "2.0"]
145148
features = ["gpu"]
146149

@@ -161,7 +164,7 @@ dependencies = [
161164
features = ["test", "extra", "gpu"]
162165

163166
[[tool.hatch.envs.gputest.matrix]]
164-
python = ["3.11", "3.12"]
167+
python = ["3.11", "3.12", "3.13"]
165168
numpy = ["1.25", "1.26", "2.0"]
166169
version = ["minimal"]
167170

@@ -207,34 +210,33 @@ extend-exclude = [
207210

208211
[tool.ruff.lint]
209212
extend-select = [
210-
"ANN", # flake8-annotations
211-
"B", # flake8-bugbear
212-
"C4", # flake8-comprehensions
213-
"FLY", # flynt
214-
"G", # flake8-logging-format
215-
"I", # isort
216-
"ISC", # flake8-implicit-str-concat
217-
"PGH", # pygrep-hooks
218-
"PT", # flake8-pytest-style
219-
"PYI", # flake8-pyi
220-
"RSE", # flake8-raise
221-
"RET", # flake8-return
213+
"ANN", # flake8-annotations
214+
"B", # flake8-bugbear
215+
"C4", # flake8-comprehensions
216+
"FLY", # flynt
217+
"G", # flake8-logging-format
218+
"I", # isort
219+
"ISC", # flake8-implicit-str-concat
220+
"PERF", # Perflint
221+
"PGH", # pygrep-hooks
222+
"PT", # flake8-pytest-style
223+
"PYI", # flake8-pyi
224+
"RSE", # flake8-raise
225+
"RET", # flake8-return
222226
"RUF",
223-
"TCH", # flake8-type-checking
224-
"TRY", # tryceratops
225-
"UP", # pyupgrade
226-
"W", # pycodestyle warnings
227+
"TCH", # flake8-type-checking
228+
"TRY", # tryceratops
229+
"UP", # pyupgrade
230+
"W", # pycodestyle warnings
227231
]
228232
ignore = [
229-
"ANN003",
230-
"ANN101",
231-
"ANN102",
233+
"ANN101", # deprecated
234+
"ANN102", # deprecated
232235
"ANN401",
233236
"PT004", # deprecated
234237
"PT005", # deprecated
235238
"PT011", # TODO: apply this rule
236239
"PT012", # TODO: apply this rule
237-
"PYI013",
238240
"RET505",
239241
"RET506",
240242
"RUF005",

src/zarr/abc/codec.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,14 @@ async def encode(
156156
class ArrayArrayCodec(BaseCodec[NDBuffer, NDBuffer]):
157157
"""Base class for array-to-array codecs."""
158158

159-
...
160-
161159

162160
class ArrayBytesCodec(BaseCodec[NDBuffer, Buffer]):
163161
"""Base class for array-to-bytes codecs."""
164162

165-
...
166-
167163

168164
class BytesBytesCodec(BaseCodec[Buffer, Buffer]):
169165
"""Base class for bytes-to-bytes codecs."""
170166

171-
...
172-
173167

174168
Codec = ArrayArrayCodec | ArrayBytesCodec | BytesBytesCodec
175169

src/zarr/api/asynchronous.py

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ async def consolidate_metadata(
170170
The group, with the ``consolidated_metadata`` field set to include
171171
the metadata of each child node.
172172
"""
173-
store_path = await make_store_path(store)
174-
175-
if path is not None:
176-
store_path = store_path / path
173+
store_path = await make_store_path(store, path=path)
177174

178175
group = await AsyncGroup.open(store_path, zarr_format=zarr_format, use_consolidated=False)
179176
group.store_path.store._check_writable()
@@ -291,10 +288,7 @@ async def open(
291288
"""
292289
zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
293290

294-
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
295-
296-
if path is not None:
297-
store_path = store_path / path
291+
store_path = await make_store_path(store, mode=mode, path=path, storage_options=storage_options)
298292

299293
if "shape" not in kwargs and mode in {"a", "w", "w-"}:
300294
try:
@@ -401,9 +395,7 @@ async def save_array(
401395
)
402396

403397
mode = kwargs.pop("mode", None)
404-
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
405-
if path is not None:
406-
store_path = store_path / path
398+
store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options)
407399
new = await AsyncArray.create(
408400
store_path,
409401
zarr_format=zarr_format,
@@ -582,9 +574,7 @@ async def group(
582574

583575
mode = None if isinstance(store, Store) else cast(AccessModeLiteral, "a")
584576

585-
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
586-
if path is not None:
587-
store_path = store_path / path
577+
store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options)
588578

589579
if chunk_store is not None:
590580
warnings.warn("chunk_store is not yet implemented", RuntimeWarning, stacklevel=2)
@@ -697,9 +687,7 @@ async def open_group(
697687
if chunk_store is not None:
698688
warnings.warn("chunk_store is not yet implemented", RuntimeWarning, stacklevel=2)
699689

700-
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
701-
if path is not None:
702-
store_path = store_path / path
690+
store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path)
703691

704692
if attributes is None:
705693
attributes = {}
@@ -883,9 +871,7 @@ async def create(
883871
if not isinstance(store, Store | StorePath):
884872
mode = "a"
885873

886-
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
887-
if path is not None:
888-
store_path = store_path / path
874+
store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options)
889875

890876
return await AsyncArray.create(
891877
store_path,
@@ -925,6 +911,7 @@ async def empty(
925911
retrieve data from an empty Zarr array, any values may be returned,
926912
and these are not guaranteed to be stable from one access to the next.
927913
"""
914+
928915
return await create(shape=shape, fill_value=None, **kwargs)
929916

930917

@@ -1044,7 +1031,7 @@ async def open_array(
10441031
store: StoreLike | None = None,
10451032
zarr_version: ZarrFormat | None = None, # deprecated
10461033
zarr_format: ZarrFormat | None = None,
1047-
path: PathLike | None = None,
1034+
path: PathLike = "",
10481035
storage_options: dict[str, Any] | None = None,
10491036
**kwargs: Any, # TODO: type kwargs as valid args to save
10501037
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
@@ -1071,9 +1058,7 @@ async def open_array(
10711058
"""
10721059

10731060
mode = kwargs.pop("mode", None)
1074-
store_path = await make_store_path(store, mode=mode)
1075-
if path is not None:
1076-
store_path = store_path / path
1061+
store_path = await make_store_path(store, path=path, mode=mode)
10771062

10781063
zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
10791064

src/zarr/core/array.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2873,13 +2873,7 @@ def chunks_initialized(
28732873
store_contents = list(
28742874
collect_aiterator(array.store_path.store.list_prefix(prefix=array.store_path.path))
28752875
)
2876-
out: list[str] = []
2877-
2878-
for chunk_key in array._iter_chunk_keys():
2879-
if chunk_key in store_contents:
2880-
out.append(chunk_key)
2881-
2882-
return tuple(out)
2876+
return tuple(chunk_key for chunk_key in array._iter_chunk_keys() if chunk_key in store_contents)
28832877

28842878

28852879
def _build_parents(

0 commit comments

Comments
 (0)