Skip to content

Commit 3b387af

Browse files
committed
Deprecated partial read/writes in v2
1 parent 2bf7e45 commit 3b387af

File tree

4 files changed

+39
-21
lines changed

4 files changed

+39
-21
lines changed

docs/release.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@ Release notes
1414
# re-indented so that it does not show up in the notes.
1515
1616
.. note::
17-
Zarr-Python 2.18.* is expected be the final release in the 2.* series. Work on Zarr-Python 3.0 is underway.
18-
See `GH1777 <https://github.com/zarr-developers/zarr-python/issues/1777>`_ for more details on the upcoming
19-
3.0 release.
17+
Zarr-Python 2.* is in support mode now, and no new features will be added.
18+
19+
20+
Unreleased
21+
----------
22+
23+
Deprecations
24+
~~~~~~~~~~~~
25+
26+
* Deprecated support for ``partial_decompress`` when creating an array.
27+
This functionality is no longer supported in ``numcodecs``, and will be removed
28+
in ``zarr-python`` 2.19.0.
29+
By :user:`David Stansby <dstansby>`
2030

2131
.. _release_2.18.4:
2232

@@ -40,9 +50,6 @@ Maintenance
4050
the Delta filter (see https://github.com/zarr-developers/numcodecs/issues/653 for more information).
4151
By :user:`David Stansby <dstansby>` (:issue:`2544`).
4252

43-
Deprecations
44-
~~~~~~~~~~~~
45-
4653
.. _release_2.18.3:
4754

4855
2.18.3

zarr/core.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import binascii
22
import hashlib
3+
from inspect import stack
34
import itertools
45
import math
56
import operator
67
import re
7-
from functools import reduce
8+
from functools import partial, reduce
89
from typing import Any
10+
import warnings
911

1012
import numpy as np
1113
from numcodecs.compat import ensure_bytes
@@ -90,13 +92,6 @@ class Array:
9092
If True (default), user attributes will be cached for attribute read
9193
operations. If False, user attributes are reloaded from the store prior
9294
to all attribute read operations.
93-
partial_decompress : bool, optional
94-
If True and while the chunk_store is a FSStore and the compression used
95-
is Blosc, when getting data from the array chunks will be partially
96-
read and decompressed when possible.
97-
98-
.. versionadded:: 2.7
99-
10095
write_empty_chunks : bool, optional
10196
If True, all chunks will be stored regardless of their contents. If
10297
False (default), each chunk is compared to the array's fill value prior
@@ -124,7 +119,7 @@ def __init__(
124119
synchronizer=None,
125120
cache_metadata=True,
126121
cache_attrs=True,
127-
partial_decompress=False,
122+
partial_decompress=None,
128123
write_empty_chunks=True,
129124
zarr_version=None,
130125
meta_array=None,
@@ -154,6 +149,13 @@ def __init__(
154149
self._synchronizer = synchronizer
155150
self._cache_metadata = cache_metadata
156151
self._is_view = False
152+
if partial_decompress is not None:
153+
warnings.warn(
154+
"Support for partial decompression is no longer supported in numcodecs. "
155+
"Support for partial decompression will be removed in a future version of zarr-python v2.",
156+
DeprecationWarning,
157+
stacklevel=1,
158+
)
157159
self._partial_decompress = partial_decompress
158160
self._write_empty_chunks = write_empty_chunks
159161
if meta_array is not None:

zarr/creation.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def open_array(
466466
object_codec=None,
467467
chunk_store=None,
468468
storage_options=None,
469-
partial_decompress=False,
469+
partial_decompress=None,
470470
write_empty_chunks=True,
471471
*,
472472
zarr_version=None,
@@ -522,10 +522,6 @@ def open_array(
522522
storage_options : dict
523523
If using an fsspec URL to create the store, these will be passed to
524524
the backend implementation. Ignored otherwise.
525-
partial_decompress : bool, optional
526-
If True and while the chunk_store is a FSStore and the compression used
527-
is Blosc, when getting data from the array chunks will be partially
528-
read and decompressed when possible.
529525
write_empty_chunks : bool, optional
530526
If True (default), all chunks will be stored regardless of their
531527
contents. If False, each chunk is compared to the array's fill value

zarr/tests/test_core.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import sys
33
import pickle
44
import shutil
5+
import re
6+
57
from typing import Any, Literal, Optional, Tuple, Union, Sequence
68
import unittest
79
from itertools import zip_longest
@@ -84,6 +86,11 @@
8486

8587
# noinspection PyMethodMayBeStatic
8688

89+
pytestmark = [
90+
pytest.mark.filterwarnings("ignore:Call to deprecated function .* \_cbuffer\_sizes.*"),
91+
pytest.mark.filterwarnings("ignore:Call to deprecated function .* \_cbuffer\_metainfo.*"),
92+
]
93+
8794

8895
class TestArray:
8996
version = 2
@@ -94,7 +101,7 @@ class TestArray:
94101
dimension_separator: Optional[DIMENSION_SEPARATOR] = None
95102
cache_metadata = True
96103
cache_attrs = True
97-
partial_decompress: bool = False
104+
partial_decompress: bool | None = None
98105
write_empty_chunks = True
99106
read_only = False
100107
storage_transformers: Tuple[Any, ...] = ()
@@ -2481,6 +2488,9 @@ def expected(self):
24812488

24822489

24832490
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
2491+
@pytest.mark.filterwarnings(
2492+
"ignore:.*Support for partial decompression will be removed in a future version.*"
2493+
)
24842494
class TestArrayWithFSStorePartialRead(TestArray):
24852495
compressor = Blosc(blocksize=256)
24862496
partial_decompress = True
@@ -2547,6 +2557,9 @@ def expected(self):
25472557

25482558

25492559
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
2560+
@pytest.mark.filterwarnings(
2561+
"ignore:.*Support for partial decompression will be removed in a future version.*"
2562+
)
25502563
class TestArrayWithFSStoreNestedPartialRead(TestArrayWithFSStore):
25512564
compressor = Blosc()
25522565
dimension_separator = "/"

0 commit comments

Comments
 (0)