From 5164c415b2de513140b7d3893289890bc84ebaed Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Mon, 19 Oct 2026 22:19:39 +0200 Subject: [PATCH] chore: tidy changelog fragments and test docstring for the VerboseModule removal Rename the changelog fragment from the issue number (4029) to the PR number (4505), as changes/README.md requires, and shorten it to the user-visible effect. Add a removal fragment for the dropped `zarr.storage.default_compressor` deprecation warning, as the deprecation policy in docs/contributing.md requires when a deprecated API is finally removed. Replace the comment block in test_storage_module_is_picklable with a docstring, matching the neighboring tests. Assisted-by: ClaudeCode:claude-fable-5-1 Co-Authored-By: Claude Fable 5.1 --- changes/4029.bugfix.md | 8 -------- changes/4505.bugfix.md | 1 + changes/4505.removal.md | 1 + tests/test_store/test_core.py | 13 ++++++------- 4 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 changes/4029.bugfix.md create mode 100644 changes/4505.bugfix.md create mode 100644 changes/4505.removal.md diff --git a/changes/4029.bugfix.md b/changes/4029.bugfix.md deleted file mode 100644 index b4abda7658..0000000000 --- a/changes/4029.bugfix.md +++ /dev/null @@ -1,8 +0,0 @@ -`zarr.storage` is no longer replaced by a `ModuleType` subclass at import time. -The subclass only existed to warn about the long-deprecated -`zarr.storage.default_compressor` attribute, but serializers that dispatch on -the exact type of an object (such as `cloudpickle`, which Dask uses by default) -could not serialize the module and raised -`TypeError: cannot pickle 'VerboseModule' object`. Setting -`zarr.storage.default_compressor` no longer emits a deprecation warning; use -`zarr.config` to configure `array.v2_default_compressor` instead. diff --git a/changes/4505.bugfix.md b/changes/4505.bugfix.md new file mode 100644 index 0000000000..8d50b8efb6 --- /dev/null +++ b/changes/4505.bugfix.md @@ -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`. diff --git a/changes/4505.removal.md b/changes/4505.removal.md new file mode 100644 index 0000000000..6549a77c95 --- /dev/null +++ b/changes/4505.removal.md @@ -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. diff --git a/tests/test_store/test_core.py b/tests/test_store/test_core.py index c928ba8417..f0a2077a8a 100644 --- a/tests/test_store/test_core.py +++ b/tests/test_store/test_core.py @@ -439,12 +439,11 @@ def test_different_open_mode(tmp_path: Path) -> None: def test_storage_module_is_picklable() -> None: - # `zarr.storage` used to be swapped for a `VerboseModule` subclass of - # `types.ModuleType` in order to warn about the long-deprecated - # `zarr.storage.default_compressor` attribute. cloudpickle dispatches on the - # exact type of an object, so the subclass was not registered and - # serializing the module raised `TypeError: cannot pickle 'VerboseModule' - # object`, which broke passing `zarr.storage.ObjectStore` around with Dask. - # See issue #4029. + """ + `zarr.storage` is a plain `types.ModuleType` and round-trips through `cloudpickle`. + + Serializers such as `cloudpickle` dispatch on the exact type of an object, so a + `ModuleType` subclass would not be serializable. See issue #4029. + """ assert type(zarr.storage) is ModuleType assert cloudpickle.loads(cloudpickle.dumps(zarr.storage)) is zarr.storage