Skip to content

Commit fb01742

Browse files
authored
Deprecate partial read/writes in v2 (#2844)
* Deprecated partial read/writes in v2 * Remove unused imports * Filter warnings on more partial read/write tests
1 parent 2bf7e45 commit fb01742

File tree

4 files changed

+42
-20
lines changed

4 files changed

+42
-20
lines changed

docs/release.rst

+13-6
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

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import re
77
from functools import reduce
88
from typing import Any
9+
import warnings
910

1011
import numpy as np
1112
from numcodecs.compat import ensure_bytes
@@ -90,13 +91,6 @@ class Array:
9091
If True (default), user attributes will be cached for attribute read
9192
operations. If False, user attributes are reloaded from the store prior
9293
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-
10094
write_empty_chunks : bool, optional
10195
If True, all chunks will be stored regardless of their contents. If
10296
False (default), each chunk is compared to the array's fill value prior
@@ -124,7 +118,7 @@ def __init__(
124118
synchronizer=None,
125119
cache_metadata=True,
126120
cache_attrs=True,
127-
partial_decompress=False,
121+
partial_decompress=None,
128122
write_empty_chunks=True,
129123
zarr_version=None,
130124
meta_array=None,
@@ -154,6 +148,13 @@ def __init__(
154148
self._synchronizer = synchronizer
155149
self._cache_metadata = cache_metadata
156150
self._is_view = False
151+
if partial_decompress is not None:
152+
warnings.warn(
153+
"Support for partial decompression is no longer supported in numcodecs. "
154+
"Support for partial decompression will be removed in a future version of zarr-python v2.",
155+
DeprecationWarning,
156+
stacklevel=1,
157+
)
157158
self._partial_decompress = partial_decompress
158159
self._write_empty_chunks = write_empty_chunks
159160
if meta_array is not None:

zarr/creation.py

+1-5
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

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
import pickle
44
import shutil
5+
56
from typing import Any, Literal, Optional, Tuple, Union, Sequence
67
import unittest
78
from itertools import zip_longest
@@ -84,6 +85,11 @@
8485

8586
# noinspection PyMethodMayBeStatic
8687

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

8894
class TestArray:
8995
version = 2
@@ -94,7 +100,7 @@ class TestArray:
94100
dimension_separator: Optional[DIMENSION_SEPARATOR] = None
95101
cache_metadata = True
96102
cache_attrs = True
97-
partial_decompress: bool = False
103+
partial_decompress: bool | None = None
98104
write_empty_chunks = True
99105
read_only = False
100106
storage_transformers: Tuple[Any, ...] = ()
@@ -2481,6 +2487,9 @@ def expected(self):
24812487

24822488

24832489
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
2490+
@pytest.mark.filterwarnings(
2491+
"ignore:.*Support for partial decompression will be removed in a future version.*"
2492+
)
24842493
class TestArrayWithFSStorePartialRead(TestArray):
24852494
compressor = Blosc(blocksize=256)
24862495
partial_decompress = True
@@ -2547,6 +2556,9 @@ def expected(self):
25472556

25482557

25492558
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
2559+
@pytest.mark.filterwarnings(
2560+
"ignore:.*Support for partial decompression will be removed in a future version.*"
2561+
)
25502562
class TestArrayWithFSStoreNestedPartialRead(TestArrayWithFSStore):
25512563
compressor = Blosc()
25522564
dimension_separator = "/"
@@ -3020,6 +3032,9 @@ def expected(self):
30203032

30213033
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
30223034
@pytest.mark.skipif(not v3_api_available, reason="V3 is disabled")
3035+
@pytest.mark.filterwarnings(
3036+
"ignore:.*Support for partial decompression will be removed in a future version.*"
3037+
)
30233038
class TestArrayWithFSStoreV3PartialRead(TestArrayWithFSStoreV3):
30243039
partial_decompress = True
30253040

@@ -3038,6 +3053,9 @@ def expected(self):
30383053
@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
30393054
@pytest.mark.skipif(not v3_api_available, reason="V3 is disabled")
30403055
@pytest.mark.skipif(not v3_sharding_available, reason="sharding is disabled")
3056+
@pytest.mark.filterwarnings(
3057+
"ignore:.*Support for partial decompression will be removed in a future version.*"
3058+
)
30413059
class TestArrayWithFSStoreV3PartialReadUncompressedSharded(TestArrayWithFSStoreV3):
30423060
partial_decompress = True
30433061
compressor = None

0 commit comments

Comments
 (0)