Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8da1333
chore(deps): bump the actions group across 1 directory with 8 updates…
dependabot[bot] May 31, 2026
659c734
Merge branch 'main' of https://github.com/d-v-b/zarr-python
d-v-b Jun 6, 2026
51c994b
Merge branch 'main' of https://github.com/zarr-developers/zarr-python
d-v-b Jun 6, 2026
117b7ba
Merge branch 'main' of github.com:d-v-b/zarr-python
d-v-b Jun 12, 2026
d4de75d
Merge branch 'main' of github.com:zarr-developers/zarr-python
d-v-b Jun 12, 2026
86dabd5
Merge branch 'main' of github.com:zarr-developers/zarr-python
d-v-b Jun 12, 2026
6a38bc1
refactor: dedupe overwrite-check logic in array creation
d-v-b Jun 12, 2026
967677f
refactor: inline single-caller get-selection wrappers
d-v-b Jun 12, 2026
7dad0bf
refactor: unify zarr-dtype access via metadata.dtype
d-v-b Jun 12, 2026
3557c5f
refactor: make Array.cdata_shape delegate to _chunk_grid_shape
d-v-b Jun 12, 2026
14ff045
refactor: inline no-op default_filters_v3
d-v-b Jun 12, 2026
c1af23d
refactor: dedupe contains_group V3 branch via _contains_node_v3
d-v-b Jun 12, 2026
1cdc299
refactor: extract not-yet-implemented kwarg warning helper
d-v-b Jun 12, 2026
1af0faa
refactor: fold fill_value extraction into _like_args
d-v-b Jun 12, 2026
285b19e
Merge branch 'main' into claude/internal-simplifications
d-v-b Jun 26, 2026
9ca2870
Merge branch 'main' into claude/internal-simplifications
d-v-b Jun 27, 2026
66828b9
fix: catch UnicodeDecodeError in _contains_node_v3
d-v-b Jul 2, 2026
40ef717
Merge branch 'main' into claude/internal-simplifications
d-v-b Jul 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 42 additions & 30 deletions src/zarr/api/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@ def _infer_overwrite(mode: AccessModeLiteral) -> bool:
return mode in _OVERWRITE_MODES


def _warn_unimplemented_kwargs(kwargs: dict[str, Any]) -> None:
"""
Emit a "not yet implemented" warning for each provided keyword argument that is not None.

``kwargs`` maps a keyword argument name to its supplied value. The ``stacklevel`` is chosen
so the warning points at the caller of the public API function (the same location as an
inline ``warnings.warn(..., stacklevel=2)`` would).
"""
for name, value in kwargs.items():
if value is not None:
warnings.warn(f"{name} is not yet implemented", ZarrRuntimeWarning, stacklevel=3)


def _get_shape_chunks(a: ArrayLike | Any) -> tuple[tuple[int, ...] | None, tuple[int, ...] | None]:
"""Helper function to get the shape and chunks from an array-like object"""
shape = None
Expand All @@ -134,6 +147,7 @@ class _LikeArgs(TypedDict):
filters: NotRequired[tuple[Numcodec, ...] | None]
compressor: NotRequired[CompressorLikev2]
codecs: NotRequired[tuple[Codec, ...]]
fill_value: NotRequired[Any]


def _like_args(a: ArrayLike) -> _LikeArgs:
Expand All @@ -151,6 +165,7 @@ def _like_args(a: ArrayLike) -> _LikeArgs:
new["dtype"] = a.dtype

if isinstance(a, AsyncArray | Array):
new["fill_value"] = a.metadata.fill_value
if isinstance(a.metadata, ArrayV2Metadata):
new["order"] = a.order
new["compressor"] = a.metadata.compressor
Expand Down Expand Up @@ -813,14 +828,14 @@ async def open_group(
The new group.
"""

if cache_attrs is not None:
warnings.warn("cache_attrs is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if synchronizer is not None:
warnings.warn("synchronizer is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if meta_array is not None:
warnings.warn("meta_array is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if chunk_store is not None:
warnings.warn("chunk_store is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
_warn_unimplemented_kwargs(
{
"cache_attrs": cache_attrs,
"synchronizer": synchronizer,
"meta_array": meta_array,
"chunk_store": chunk_store,
}
)

store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path)
if attributes is None:
Expand Down Expand Up @@ -1010,20 +1025,17 @@ async def create(
if zarr_format is None:
zarr_format = _default_zarr_format()

if synchronizer is not None:
warnings.warn("synchronizer is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if chunk_store is not None:
warnings.warn("chunk_store is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if cache_metadata is not None:
warnings.warn("cache_metadata is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if cache_attrs is not None:
warnings.warn("cache_attrs is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if object_codec is not None:
warnings.warn("object_codec is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if read_only is not None:
warnings.warn("read_only is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
if meta_array is not None:
warnings.warn("meta_array is not yet implemented", ZarrRuntimeWarning, stacklevel=2)
_warn_unimplemented_kwargs(
{
"synchronizer": synchronizer,
"chunk_store": chunk_store,
"cache_metadata": cache_metadata,
"cache_attrs": cache_attrs,
"object_codec": object_codec,
"read_only": read_only,
"meta_array": meta_array,
}
)

if write_empty_chunks is not None:
_warn_write_empty_chunks_kwarg()
Expand Down Expand Up @@ -1111,8 +1123,6 @@ async def empty_like(a: ArrayLike, **kwargs: Any) -> AnyAsyncArray:
and these are not guaranteed to be stable from one access to the next.
"""
like_kwargs = _like_args(a) | kwargs
if isinstance(a, (AsyncArray | Array)):
like_kwargs.setdefault("fill_value", a.metadata.fill_value)
return await empty(**like_kwargs) # type: ignore[arg-type]


Expand Down Expand Up @@ -1155,8 +1165,6 @@ async def full_like(a: ArrayLike, **kwargs: Any) -> AnyAsyncArray:
The new array.
"""
like_kwargs = _like_args(a) | kwargs
if isinstance(a, (AsyncArray | Array)):
like_kwargs.setdefault("fill_value", a.metadata.fill_value)
return await full(**like_kwargs) # type: ignore[arg-type]


Expand Down Expand Up @@ -1194,7 +1202,10 @@ async def ones_like(a: ArrayLike, **kwargs: Any) -> AnyAsyncArray:
Array
The new array.
"""
like_kwargs = _like_args(a) | kwargs
like_args = _like_args(a)
# `ones` supplies its own fill_value, so drop any inherited from `a`.
like_args.pop("fill_value", None)
like_kwargs = like_args | kwargs
return await ones(**like_kwargs) # type: ignore[arg-type]


Expand Down Expand Up @@ -1270,8 +1281,6 @@ async def open_like(a: ArrayLike, path: str, **kwargs: Any) -> AnyAsyncArray:
The opened array.
"""
like_kwargs = _like_args(a) | kwargs
if isinstance(a, (AsyncArray | Array)):
like_kwargs.setdefault("fill_value", a.metadata.fill_value)
return await open_array(path=path, **like_kwargs) # type: ignore[arg-type]


Expand Down Expand Up @@ -1309,5 +1318,8 @@ async def zeros_like(a: ArrayLike, **kwargs: Any) -> AnyAsyncArray:
Array
The new array.
"""
like_kwargs = _like_args(a) | kwargs
like_args = _like_args(a)
# `zeros` supplies its own fill_value, so drop any inherited from `a`.
like_args.pop("fill_value", None)
like_kwargs = like_args | kwargs
return await zeros(**like_kwargs) # type: ignore[arg-type]
Loading
Loading