Skip to content

Commit

Permalink
Deprecate N5Store (#2103)
Browse files Browse the repository at this point in the history
* deprecate(n5): add deprecation warning to N5Store

* also deprecate N5FSStore

* docs

* fix doc
  • Loading branch information
jhamman committed Aug 26, 2024
1 parent d1b92b5 commit 2e928b1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,26 @@ Enhancements
~~~~~~~~~~~~
* Added support for creating a copy of data when converting a `zarr.Array`
to a numpy array.
By :user:`David Stansby <dstansby>`
By :user:`David Stansby <dstansby>` (:issue:`2106`) and
:user:`Joe Hamman <jhamman>` (:issue:`2123`).

Maintenance
~~~~~~~~~~~
* Removed support for Python 3.9.
By :user:`David Stansby <dstansby>`
By :user:`David Stansby <dstansby>` (:issue:`2074`).

* Fix a regression when using orthogonal indexing with a scalar.
By :user:`Deepak Cherian <dcherian>` :issue:`1931`

* Added compatibility with numpy 2.1.
By :user:`David Stansby <dstansby>`

Deprecations
~~~~~~~~~~~~

* Deprecate :class:`zarr.n5.N5Store` and :class:`zarr.n5.N5FSStore`. These
stores are slated to be removed in Zarr Python 3.0.
By :user:`Joe Hamman <jhamman>` :issue:`2085`.

.. _release_2.18.2:

Expand Down
22 changes: 22 additions & 0 deletions zarr/n5.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,20 @@ class N5Store(NestedDirectoryStore):
Safe to write in multiple threads or processes.
.. deprecated:: 2.18.3
`N5Store` will be removed in Zarr 3.0.0.
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
warnings.warn(
"The N5Store is deprecated and will be removed in a Zarr-Python version 3, "
"see https://github.com/zarr-developers/zarr-python/issues/1274 and "
"https://github.com/zarr-developers/n5py for more information.",
FutureWarning,
stacklevel=2,
)

def __getitem__(self, key: str) -> bytes:
if key.endswith(zarr_group_meta_key):
key_new = key.replace(zarr_group_meta_key, n5_attrs_key)
Expand Down Expand Up @@ -322,13 +334,23 @@ class N5FSStore(FSStore):
storage, and this procedure requires chunk keys with "." separated
dimensions, hence the Zarr arrays targeting N5 have the deceptive
"." dimension separator.
.. deprecated:: 2.18.3
`N5FSStore` will be removed in Zarr 3.0.0.
"""

_array_meta_key = "attributes.json"
_group_meta_key = "attributes.json"
_attrs_key = "attributes.json"

def __init__(self, *args, **kwargs):
warnings.warn(
"The N5FSStore is deprecated and will be removed in a Zarr-Python version 3, "
"see https://github.com/zarr-developers/zarr-python/issues/1274 and "
"https://github.com/zarr-developers/n5py for more information.",
FutureWarning,
stacklevel=2,
)
if "dimension_separator" in kwargs:
kwargs.pop("dimension_separator")
warnings.warn(
Expand Down

0 comments on commit 2e928b1

Please sign in to comment.