Skip to content

Commit 7b7cbde

Browse files
authored
Merge branch 'support/v2' into array-hexdigest-zlibng-v2
2 parents c544a50 + c969f5c commit 7b7cbde

16 files changed

+65
-114
lines changed

.readthedocs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ build:
44
os: ubuntu-20.04
55
tools:
66
python: "3.11"
7+
jobs:
8+
post_checkout:
9+
- git fetch --unshallow || true
710

811
sphinx:
912
configuration: docs/conf.py

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"sphinx_issues",
4545
"sphinx_copybutton",
4646
"sphinx_design",
47+
"pytest_doctestplus.sphinx.doctestplus",
4748
]
4849

4950
numpydoc_show_class_members = False
@@ -72,8 +73,8 @@
7273
copyright = "2024, Zarr Developers"
7374
author = "Zarr Developers"
7475

75-
version = get_version("zarr")
7676
release = get_version("zarr")
77+
version = get_version("zarr")
7778

7879
# The language for content autogenerated by Sphinx. Refer to documentation
7980
# for a list of supported languages.

docs/release.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Release notes
2020

2121
.. _release_2.18.4:
2222

23-
2.18.4 (unreleased)
24-
-------------------
23+
2.18.4
24+
------
2525

2626
Enhancements
2727
~~~~~~~~~~~~
@@ -36,6 +36,9 @@ Maintenance
3636
``zarr-python`` if you can install it, but to reduce our maintenance
3737
burden we will no longer run our compatibility tests for it.
3838
By :user:`David Stansby <dstansby>` (:issue:`2344`).
39+
* Excluded versions 0.14.0 and 0.14.1 of numcodecs, due to a bug in the implementation of
40+
the Delta filter (see https://github.com/zarr-developers/numcodecs/issues/653 for more information).
41+
By :user:`David Stansby <dstansby>` (:issue:`2544`).
3942

4043
Deprecations
4144
~~~~~~~~~~~~

docs/tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ Another storage alternative is the :class:`zarr.storage.DBMStore` class, added
809809
in Zarr version 2.2. This class allows any DBM-style database to be used for
810810
storing an array or group. Here is an example using a Berkeley DB B-tree
811811
database for storage (requires `bsddb3
812-
<https://www.jcea.es/programacion/pybsddb.htm>`_ to be installed)::
812+
<https://www.jcea.es/programacion/pybsddb.htm>`_ to be installed):
813813

814814
.. doctest-requires:: bsddb3
815815

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=64.0.0", "setuptools-scm>1.5.4"]
2+
requires = ["setuptools>=64", "setuptools-scm>8"]
33
build-backend = "setuptools.build_meta"
44

55

@@ -13,7 +13,7 @@ dependencies = [
1313
'asciitree',
1414
'numpy>=1.24',
1515
'fasteners; sys_platform != "emscripten"',
16-
'numcodecs>=0.10.0',
16+
'numcodecs>=0.10.0,!=0.14.0,!=0.14.1',
1717
]
1818
dynamic = ["version"]
1919
classifiers = [
@@ -42,7 +42,8 @@ docs = [
4242
'sphinx-copybutton',
4343
'pydata-sphinx-theme',
4444
'numpydoc',
45-
'numcodecs[msgpack]',
45+
'numcodecs[msgpack]!=0.14.0,!=0.14.1',
46+
'pytest-doctestplus',
4647
]
4748

4849
[project.urls]
@@ -67,9 +68,8 @@ packages = ["zarr", "zarr._storage", "zarr.tests"]
6768
license-files = ["LICENSE.txt"]
6869

6970
[tool.setuptools_scm]
70-
version_scheme = "guess-next-dev"
7171
local_scheme = "dirty-tag"
72-
write_to = "zarr/version.py"
72+
version_file = "zarr/version.py"
7373

7474
[tool.ruff]
7575
line-length = 100

requirements_dev_optional.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pymongo==4.10.1
1515
# optional test requirements
1616
coverage
1717
pytest-cov==5.0.0
18-
pytest-doctestplus==1.2.1
18+
pytest-doctestplus==1.3.0
1919
pytest-timeout==2.3.1
2020
h5py==3.12.1
2121
fsspec==2023.12.2

zarr/convenience.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
_builtin_open = open # builtin open is later shadowed by a local open function
3333

34+
__doctest_requires__ = {("*"): ["numpy>=2.2"]}
35+
3436

3537
def _check_and_update_path(store: BaseStore, path):
3638
if getattr(store, "_store_version", 2) > 2 and not path:
@@ -174,13 +176,13 @@ def save_array(store: StoreLike, arr, *, zarr_version=None, path=None, **kwargs)
174176
>>> arr = np.arange(10000)
175177
>>> zarr.save_array('data/example.zarr', arr)
176178
>>> zarr.load('data/example.zarr')
177-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
179+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
178180
179181
Save an array to a single file (uses a :class:`ZipStore`)::
180182
181183
>>> zarr.save_array('data/example.zip', arr)
182184
>>> zarr.load('data/example.zip')
183-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
185+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
184186
185187
"""
186188
may_need_closing = _might_close(store)
@@ -234,9 +236,9 @@ def save_group(store: StoreLike, *args, zarr_version=None, path=None, **kwargs):
234236
>>> loader
235237
<LazyLoader: arr_0, arr_1>
236238
>>> loader['arr_0']
237-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
239+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
238240
>>> loader['arr_1']
239-
array([10000, 9999, 9998, ..., 3, 2, 1])
241+
array([10000, 9999, 9998, ..., 3, 2, 1], shape=(10000,))
240242
241243
Save several arrays using named keyword arguments::
242244
@@ -245,9 +247,9 @@ def save_group(store: StoreLike, *args, zarr_version=None, path=None, **kwargs):
245247
>>> loader
246248
<LazyLoader: bar, foo>
247249
>>> loader['foo']
248-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
250+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
249251
>>> loader['bar']
250-
array([10000, 9999, 9998, ..., 3, 2, 1])
252+
array([10000, 9999, 9998, ..., 3, 2, 1], shape=(10000,))
251253
252254
Store several arrays in a single zip file (uses a :class:`ZipStore`)::
253255
@@ -256,9 +258,9 @@ def save_group(store: StoreLike, *args, zarr_version=None, path=None, **kwargs):
256258
>>> loader
257259
<LazyLoader: bar, foo>
258260
>>> loader['foo']
259-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
261+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
260262
>>> loader['bar']
261-
array([10000, 9999, 9998, ..., 3, 2, 1])
263+
array([10000, 9999, 9998, ..., 3, 2, 1], shape=(10000,))
262264
263265
Notes
264266
-----
@@ -316,13 +318,13 @@ def save(store: StoreLike, *args, zarr_version=None, path=None, **kwargs):
316318
>>> arr = np.arange(10000)
317319
>>> zarr.save('data/example.zarr', arr)
318320
>>> zarr.load('data/example.zarr')
319-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
321+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
320322
321323
Save an array to a Zip file (uses a :class:`ZipStore`)::
322324
323325
>>> zarr.save('data/example.zip', arr)
324326
>>> zarr.load('data/example.zip')
325-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
327+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
326328
327329
Save several arrays to a directory on the file system (uses a
328330
:class:`DirectoryStore` and stores arrays in a group)::
@@ -336,9 +338,9 @@ def save(store: StoreLike, *args, zarr_version=None, path=None, **kwargs):
336338
>>> loader
337339
<LazyLoader: arr_0, arr_1>
338340
>>> loader['arr_0']
339-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
341+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
340342
>>> loader['arr_1']
341-
array([10000, 9999, 9998, ..., 3, 2, 1])
343+
array([10000, 9999, 9998, ..., 3, 2, 1], shape=(10000,))
342344
343345
Save several arrays using named keyword arguments::
344346
@@ -347,9 +349,9 @@ def save(store: StoreLike, *args, zarr_version=None, path=None, **kwargs):
347349
>>> loader
348350
<LazyLoader: bar, foo>
349351
>>> loader['foo']
350-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
352+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
351353
>>> loader['bar']
352-
array([10000, 9999, 9998, ..., 3, 2, 1])
354+
array([10000, 9999, 9998, ..., 3, 2, 1], shape=(10000,))
353355
354356
Store several arrays in a single zip file (uses a :class:`ZipStore`)::
355357
@@ -358,9 +360,9 @@ def save(store: StoreLike, *args, zarr_version=None, path=None, **kwargs):
358360
>>> loader
359361
<LazyLoader: bar, foo>
360362
>>> loader['foo']
361-
array([ 0, 1, 2, ..., 9997, 9998, 9999])
363+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
362364
>>> loader['bar']
363-
array([10000, 9999, 9998, ..., 3, 2, 1])
365+
array([10000, 9999, 9998, ..., 3, 2, 1], shape=(10000,))
364366
365367
See Also
366368
--------

zarr/core.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
)
6262

6363
__all__ = ["Array"]
64+
__doctest_requires__ = {("*"): ["numpy>=2.2"]}
6465

6566

6667
# noinspection PyUnresolvedReferences
@@ -2793,33 +2794,33 @@ def view(
27932794
>>> a = zarr.array(data, chunks=1000, filters=filters)
27942795
>>> a[:]
27952796
array(['female', 'male', 'female', ..., 'male', 'male', 'female'],
2796-
dtype='<U6')
2797+
shape=(10000,), dtype='<U6')
27972798
>>> v = a.view(dtype='u1', filters=[])
27982799
>>> v.is_view
27992800
True
28002801
>>> v[:]
2801-
array([1, 2, 1, ..., 2, 2, 1], dtype=uint8)
2802+
array([1, 2, 1, ..., 2, 2, 1], shape=(10000,), dtype=uint8)
28022803
28032804
Views can be used to modify data:
28042805
28052806
>>> x = v[:]
28062807
>>> x.sort()
28072808
>>> v[:] = x
28082809
>>> v[:]
2809-
array([1, 1, 1, ..., 2, 2, 2], dtype=uint8)
2810+
array([1, 1, 1, ..., 2, 2, 2], shape=(10000,), dtype=uint8)
28102811
>>> a[:]
28112812
array(['female', 'female', 'female', ..., 'male', 'male', 'male'],
2812-
dtype='<U6')
2813+
shape=(10000,), dtype='<U6')
28132814
28142815
View as a different dtype with the same item size:
28152816
28162817
>>> data = np.random.randint(0, 2, size=10000, dtype='u1')
28172818
>>> a = zarr.array(data, chunks=1000)
28182819
>>> a[:]
2819-
array([0, 0, 1, ..., 1, 0, 0], dtype=uint8)
2820+
array([0, 0, 1, ..., 1, 0, 0], shape=(10000,), dtype=uint8)
28202821
>>> v = a.view(dtype=bool)
28212822
>>> v[:]
2822-
array([False, False, True, ..., True, False, False])
2823+
array([False, False, True, ..., True, False, False], shape=(10000,))
28232824
>>> np.all(a[:].view(dtype=bool) == v[:])
28242825
np.True_
28252826
@@ -2841,10 +2842,10 @@ def view(
28412842
28422843
>>> a = zarr.full(10000, chunks=1000, fill_value=-1, dtype='i1')
28432844
>>> a[:]
2844-
array([-1, -1, -1, ..., -1, -1, -1], dtype=int8)
2845+
array([-1, -1, -1, ..., -1, -1, -1], shape=(10000,), dtype=int8)
28452846
>>> v = a.view(fill_value=42)
28462847
>>> v[:]
2847-
array([42, 42, 42, ..., 42, 42, 42], dtype=int8)
2848+
array([42, 42, 42, ..., 42, 42, 42], shape=(10000,), dtype=int8)
28482849
28492850
Note that resizing or appending to views is not permitted:
28502851

zarr/storage.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,13 +2069,11 @@ class DBMStore(Store):
20692069
<https://www.jcea.es/programacion/pybsddb.htm>`_ package is installed, a
20702070
Berkeley DB database can be used::
20712071
2072-
.. doctest-requires:: bsddb3
2073-
2074-
>>> import bsddb3
2075-
>>> store = zarr.DBMStore('data/array.bdb', open=bsddb3.btopen)
2076-
>>> z = zarr.zeros((10, 10), chunks=(5, 5), store=store, overwrite=True)
2077-
>>> z[...] = 42
2078-
>>> store.close()
2072+
>>> import bsddb3 # doctest: +SKIP
2073+
>>> store = zarr.DBMStore('data/array.bdb', open=bsddb3.btopen) # doctest: +SKIP
2074+
>>> z = zarr.zeros((10, 10), chunks=(5, 5), store=store, overwrite=True) # doctest: +SKIP
2075+
>>> z[...] = 42 # doctest: +SKIP
2076+
>>> store.close() # doctest: +SKIP
20792077
20802078
Notes
20812079
-----

zarr/tests/test_core.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import atexit
2-
import os
32
import sys
43
import pickle
54
import shutil
@@ -75,7 +74,6 @@
7574
from zarr.util import buffer_size
7675
from zarr.tests.util import (
7776
abs_container,
78-
have_bsddb3,
7977
have_fsspec,
8078
have_lmdb,
8179
have_sqlite3,
@@ -2083,20 +2081,6 @@ def test_nbytes_stored(self):
20832081
pass # not implemented
20842082

20852083

2086-
@pytest.mark.skipif(have_bsddb3 is False, reason="needs bsddb3")
2087-
class TestArrayWithDBMStoreBerkeleyDB(TestArray):
2088-
def create_store(self):
2089-
import bsddb3
2090-
2091-
path = mktemp(suffix=".dbm")
2092-
atexit.register(os.remove, path)
2093-
store = DBMStore(path, flag="n", open=bsddb3.btopen)
2094-
return store
2095-
2096-
def test_nbytes_stored(self):
2097-
pass # not implemented
2098-
2099-
21002084
@pytest.mark.skipif(have_lmdb is False, reason="needs lmdb")
21012085
class TestArrayWithLMDBStore(TestArray):
21022086
def create_store(self):
@@ -2840,21 +2824,6 @@ def test_nbytes_stored(self):
28402824
pass # not implemented
28412825

28422826

2843-
@pytest.mark.skipif(not v3_api_available, reason="V3 is disabled")
2844-
@pytest.mark.skipif(have_bsddb3 is False, reason="needs bsddb3")
2845-
class TestArrayWithDBMStoreV3BerkeleyDB(TestArrayV3):
2846-
def create_store(self) -> DBMStoreV3:
2847-
import bsddb3
2848-
2849-
path = mktemp(suffix=".dbm")
2850-
atexit.register(os.remove, path)
2851-
store = DBMStoreV3(path, flag="n", open=bsddb3.btopen)
2852-
return store
2853-
2854-
def test_nbytes_stored(self):
2855-
pass # not implemented
2856-
2857-
28582827
@pytest.mark.skipif(not v3_api_available, reason="V3 is disabled")
28592828
@pytest.mark.skipif(have_lmdb is False, reason="needs lmdb")
28602829
class TestArrayWithLMDBStoreV3(TestArrayV3):

0 commit comments

Comments
 (0)