Skip to content

Commit

Permalink
deprecate(chunkstore): add deprecation warning for chunk_store kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamman committed Nov 17, 2024
1 parent ed94877 commit 96ee671
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions zarr/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import math
import operator
import re
import warnings
from functools import reduce
from typing import Any

Expand Down Expand Up @@ -78,6 +79,10 @@ class Array:
chunk_store : MutableMapping, optional
Separate storage for chunks. If not provided, `store` will be used
for storage of both chunks and metadata.
[DEPRECATED since version 2.18.4] This argument is deprecated and will be
removed in version 3.0. See
`GH2495 <https://github.com/zarr-developers/zarr-python/issues/2495>`_
for more information.
synchronizer : object, optional
Array synchronizer.
cache_metadata : bool, optional
Expand Down Expand Up @@ -139,6 +144,12 @@ def __init__(
assert_zarr_v3_api_available()

if chunk_store is not None:
warnings.warn(
"chunk_store is deprecated and will be removed in a Zarr-Python version 3, see "
"https://github.com/zarr-developers/zarr-python/issues/2495 for more information.",
FutureWarning,
stacklevel=2,
)
chunk_store = normalize_store_arg(chunk_store, zarr_version=zarr_version)

self._store = store
Expand Down
4 changes: 4 additions & 0 deletions zarr/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ def open_array(
A codec to encode object arrays, only needed if dtype=object.
chunk_store : MutableMapping or string, optional
Store or path to directory in file system or name of zip file.
[DEPRECATED since version 2.18.4] This argument is deprecated and will be
removed in version 3.0. See
`GH2495 <https://github.com/zarr-developers/zarr-python/issues/2495>`_
for more information.
storage_options : dict
If using an fsspec URL to create the store, these will be passed to
the backend implementation. Ignored otherwise.
Expand Down
11 changes: 11 additions & 0 deletions zarr/hierarchy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from collections.abc import MutableMapping
from itertools import islice

Expand Down Expand Up @@ -73,6 +74,10 @@ class Group(MutableMapping):
chunk_store : MutableMapping, optional
Separate storage for chunks. If not provided, `store` will be used
for storage of both chunks and metadata.
[DEPRECATED since version 2.18.4] This argument is deprecated and will be
removed in version 3.0. See
`GH2495 <https://github.com/zarr-developers/zarr-python/issues/2495>`_
for more information.
cache_attrs : bool, optional
If True (default), user attributes will be cached for attribute read
operations. If False, user attributes are reloaded from the store prior
Expand Down Expand Up @@ -156,6 +161,12 @@ def __init__(
assert_zarr_v3_api_available()

if chunk_store is not None:
warnings.warn(
"chunk_store is deprecated and will be removed in a Zarr-Python version 3, see "
"https://github.com/zarr-developers/zarr-python/issues/2495 for more information.",
FutureWarning,
stacklevel=2,
)
chunk_store: BaseStore = _normalize_store_arg(chunk_store, zarr_version=zarr_version)
self._store = store
self._chunk_store = chunk_store
Expand Down

0 comments on commit 96ee671

Please sign in to comment.