Skip to content

Commit 29f66e6

Browse files
authored
Merge branch 'main' into PYL-R1714
2 parents 94f45e1 + df40f4f commit 29f66e6

19 files changed

+145
-148
lines changed

changes/3112.bugfix.1.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Creating a Zarr format 2 array with the ``order`` keyword argument no longer raises a warning.

changes/3112.bugfix.2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Creating a Zarr format 3 array with the ``order`` argument now conistently ignores this argument and raises a warning.

changes/3112.bugfix.3.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
When using ``from_array`` to copy a Zarr format 2 array to a Zarr format 3 array, if the memory order of the input array is ``"F"`` a warning is raised and the order ignored.
2+
This is because Zarr format 3 arrays are always stored in "C" order.

changes/3112.bugfix.4.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The ``config`` argument to `zarr.create` (and functions that create arrays) is now used - previously it had no effect.

changes/3112.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed the error message when passing both ``config`` and ``write_empty_chunks`` arguments to reflect the current behaviour (``write_empty_chunks`` takes precedence).

changes/3227.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add lightweight implementations of .getsize() and .getsize_prefix() for ObjectStore.

changes/3268.misc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removed warnings that were emitted when using the ``vlen-utf8`` and ``vlen-bytes`` codecs. Those
2+
warnings are no longer needed now that both of these codecs are backed by specification documents.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ extend-select = [
324324
ignore = [
325325
"ANN401",
326326
"PT011", # TODO: apply this rule
327-
"PT012", # TODO: apply this rule
328327
"PT030", # TODO: apply this rule
329328
"PT031", # TODO: apply this rule
330329
"RET505",

src/zarr/api/asynchronous.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from_array,
2020
get_array_metadata,
2121
)
22-
from zarr.core.array_spec import ArrayConfig, ArrayConfigLike, ArrayConfigParams
22+
from zarr.core.array_spec import ArrayConfigLike, parse_array_config
2323
from zarr.core.buffer import NDArrayLike
2424
from zarr.core.common import (
2525
JSON,
@@ -29,7 +29,6 @@
2929
MemoryOrder,
3030
ZarrFormat,
3131
_default_zarr_format,
32-
_warn_order_kwarg,
3332
_warn_write_empty_chunks_kwarg,
3433
)
3534
from zarr.core.dtype import ZDTypeLike, get_data_type_from_native_dtype
@@ -1026,8 +1025,6 @@ async def create(
10261025
if meta_array is not None:
10271026
warnings.warn("meta_array is not yet implemented", RuntimeWarning, stacklevel=2)
10281027

1029-
if order is not None:
1030-
_warn_order_kwarg()
10311028
if write_empty_chunks is not None:
10321029
_warn_write_empty_chunks_kwarg()
10331030

@@ -1036,26 +1033,17 @@ async def create(
10361033
mode = "a"
10371034
store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options)
10381035

1039-
config_dict: ArrayConfigParams = {}
1036+
config_parsed = parse_array_config(config)
10401037

10411038
if write_empty_chunks is not None:
10421039
if config is not None:
10431040
msg = (
10441041
"Both write_empty_chunks and config keyword arguments are set. "
1045-
"This is redundant. When both are set, write_empty_chunks will be ignored and "
1046-
"config will be used."
1042+
"This is redundant. When both are set, write_empty_chunks will be used instead "
1043+
"of the value in config."
10471044
)
10481045
warnings.warn(UserWarning(msg), stacklevel=1)
1049-
config_dict["write_empty_chunks"] = write_empty_chunks
1050-
if order is not None and config is not None:
1051-
msg = (
1052-
"Both order and config keyword arguments are set. "
1053-
"This is redundant. When both are set, order will be ignored and "
1054-
"config will be used."
1055-
)
1056-
warnings.warn(UserWarning(msg), stacklevel=1)
1057-
1058-
config_parsed = ArrayConfig.from_dict(config_dict)
1046+
config_parsed = dataclasses.replace(config_parsed, write_empty_chunks=write_empty_chunks)
10591047

10601048
return await AsyncArray._create(
10611049
store_path,
@@ -1258,8 +1246,6 @@ async def open_array(
12581246

12591247
zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
12601248

1261-
if "order" in kwargs:
1262-
_warn_order_kwarg()
12631249
if "write_empty_chunks" in kwargs:
12641250
_warn_write_empty_chunks_kwarg()
12651251

src/zarr/codecs/vlen_utf8.py

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

33
from dataclasses import dataclass
44
from typing import TYPE_CHECKING
5-
from warnings import warn
65

76
import numpy as np
87
from numcodecs.vlen import VLenBytes, VLenUTF8
@@ -25,15 +24,6 @@
2524

2625
@dataclass(frozen=True)
2726
class VLenUTF8Codec(ArrayBytesCodec):
28-
def __init__(self) -> None:
29-
warn(
30-
"The codec `vlen-utf8` is currently not part in the Zarr format 3 specification. It "
31-
"may not be supported by other zarr implementations and may change in the future.",
32-
category=UserWarning,
33-
stacklevel=2,
34-
)
35-
super().__init__()
36-
3727
@classmethod
3828
def from_dict(cls, data: dict[str, JSON]) -> Self:
3929
_, configuration_parsed = parse_named_configuration(
@@ -80,15 +70,6 @@ def compute_encoded_size(self, input_byte_length: int, _chunk_spec: ArraySpec) -
8070

8171
@dataclass(frozen=True)
8272
class VLenBytesCodec(ArrayBytesCodec):
83-
def __init__(self) -> None:
84-
warn(
85-
"The codec `vlen-bytes` is currently not part in the Zarr format 3 specification. It "
86-
"may not be supported by other zarr implementations and may change in the future.",
87-
category=UserWarning,
88-
stacklevel=2,
89-
)
90-
super().__init__()
91-
9273
@classmethod
9374
def from_dict(cls, data: dict[str, JSON]) -> Self:
9475
_, configuration_parsed = parse_named_configuration(

0 commit comments

Comments
 (0)