Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions changes/4505.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `zarr.storage` module can now be serialized with `cloudpickle`. Previously, code that referenced the module (for example a Dask task that used `zarr.storage.ObjectStore`) failed with `TypeError: cannot pickle 'VerboseModule' object`.
1 change: 1 addition & 0 deletions changes/4505.removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Setting `zarr.storage.default_compressor` no longer emits a deprecation warning. The attribute has had no effect since 3.0.0; configure `array.v2_default_compressor` through `zarr.config` instead.
23 changes: 0 additions & 23 deletions src/zarr/storage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import sys
import warnings
from types import ModuleType
from typing import Any

from zarr.errors import ZarrDeprecationWarning
from zarr.storage._common import StoreLike, StorePath
from zarr.storage._fsspec import FsspecStore
from zarr.storage._local import LocalStore
Expand All @@ -26,20 +20,3 @@
"WrapperStore",
"ZipStore",
]


class VerboseModule(ModuleType):
def __setattr__(self, attr: str, value: Any) -> None:
if attr == "default_compressor":
warnings.warn(
"setting zarr.storage.default_compressor is deprecated, use "
"zarr.config to configure array.v2_default_compressor "
"e.g. config.set({'codecs.zstd':'numcodecs.Zstd', 'array.v2_default_compressor.numeric': 'zstd'})",
ZarrDeprecationWarning,
stacklevel=1,
)
else:
super().__setattr__(attr, value)


sys.modules[__name__].__class__ = VerboseModule
6 changes: 0 additions & 6 deletions tests/test_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from zarr.core.dtype.wrapper import ZDType
from zarr.core.group import Group
from zarr.core.sync import sync
from zarr.errors import ZarrDeprecationWarning
from zarr.storage import MemoryStore, StorePath


Expand Down Expand Up @@ -225,11 +224,6 @@ def test_v2_non_contiguous(numpy_order: Literal["C", "F"], zarr_order: Literal["
assert (sub_arr).flags.c_contiguous


def test_default_compressor_deprecation_warning() -> None:
with pytest.warns(ZarrDeprecationWarning, match="default_compressor is deprecated"):
zarr.storage.default_compressor = "zarr.codecs.zstd.ZstdCodec()" # type: ignore[attr-defined]


@pytest.mark.parametrize("fill_value", [None, (b"", 0, 0.0)], ids=["no_fill", "fill"])
def test_structured_dtype_roundtrip(fill_value: float | bytes, tmp_path: Path) -> None:
a = np.array(
Expand Down
Loading