Skip to content

Commit 5daa82a

Browse files
committed
Merge branch 'main' of https://github.com/zarr-developers/zarr-python into feature/slim-zarr
2 parents 002b805 + 4d663cc commit 5daa82a

File tree

14 files changed

+311
-147
lines changed

14 files changed

+311
-147
lines changed

pyproject.toml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ 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
'numpy>=1.25',
2730
'numcodecs>=0.12',
28-
'typing_extensions',
29-
'donfig',
31+
'typing_extensions>=4.9',
32+
'donfig>=0.8.1',
3033
]
3134
dynamic = [
3235
"version",
@@ -49,10 +52,10 @@ keywords = ["Python", "compressed", "ndimensional-arrays", "zarr"]
4952

5053
[project.optional-dependencies]
5154
remote = [
52-
"fsspec",
55+
"fsspec>=2023.10.0",
5356
]
5457
sharding = [
55-
"crc32c",
58+
"crc32c>=2.4",
5659
]
5760
test = [
5861
"coverage",
@@ -205,34 +208,33 @@ extend-exclude = [
205208

206209
[tool.ruff.lint]
207210
extend-select = [
208-
"ANN", # flake8-annotations
209-
"B", # flake8-bugbear
210-
"C4", # flake8-comprehensions
211-
"FLY", # flynt
212-
"G", # flake8-logging-format
213-
"I", # isort
214-
"ISC", # flake8-implicit-str-concat
215-
"PGH", # pygrep-hooks
216-
"PT", # flake8-pytest-style
217-
"PYI", # flake8-pyi
218-
"RSE", # flake8-raise
219-
"RET", # flake8-return
211+
"ANN", # flake8-annotations
212+
"B", # flake8-bugbear
213+
"C4", # flake8-comprehensions
214+
"FLY", # flynt
215+
"G", # flake8-logging-format
216+
"I", # isort
217+
"ISC", # flake8-implicit-str-concat
218+
"PERF", # Perflint
219+
"PGH", # pygrep-hooks
220+
"PT", # flake8-pytest-style
221+
"PYI", # flake8-pyi
222+
"RSE", # flake8-raise
223+
"RET", # flake8-return
220224
"RUF",
221-
"TCH", # flake8-type-checking
222-
"TRY", # tryceratops
223-
"UP", # pyupgrade
224-
"W", # pycodestyle warnings
225+
"TCH", # flake8-type-checking
226+
"TRY", # tryceratops
227+
"UP", # pyupgrade
228+
"W", # pycodestyle warnings
225229
]
226230
ignore = [
227-
"ANN003",
228-
"ANN101",
229-
"ANN102",
231+
"ANN101", # deprecated
232+
"ANN102", # deprecated
230233
"ANN401",
231234
"PT004", # deprecated
232235
"PT005", # deprecated
233236
"PT011", # TODO: apply this rule
234237
"PT012", # TODO: apply this rule
235-
"PYI013",
236238
"RET505",
237239
"RET506",
238240
"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)