Skip to content

Commit 12d3f75

Browse files
authored
Merge branch 'main' into feat/latency-store
2 parents a992bbb + 1a75957 commit 12d3f75

File tree

17 files changed

+610
-520
lines changed

17 files changed

+610
-520
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,22 @@ jobs:
9393
- name: Run Tests
9494
run: |
9595
hatch env run --env ${{ matrix.dependency-set }} run
96+
97+
test-complete:
98+
name: Test complete
99+
100+
needs:
101+
[
102+
test,
103+
test-upstream-and-min-deps,
104+
]
105+
if: always()
106+
runs-on: ubuntu-latest
107+
steps:
108+
- name: Check failure
109+
if: |
110+
contains(needs.*.result, 'failure') ||
111+
contains(needs.*.result, 'cancelled')
112+
run: exit 1
113+
- name: Success
114+
run: echo Success!

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default_language_version:
77
python: python3
88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.8.1
10+
rev: v0.8.2
1111
hooks:
1212
- id: ruff
1313
args: ["--fix", "--show-fixes"]

docs/contributing.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,11 @@ the following::
9292
$ mkdir -p ~/pyenv/zarr-dev
9393
$ python -m venv ~/pyenv/zarr-dev
9494
$ source ~/pyenv/zarr-dev/bin/activate
95-
$ pip install -r requirements_dev_minimal.txt -r requirements_dev_numpy.txt
96-
$ pip install -e .[docs]
95+
$ pip install -e .[test,docs]
9796

9897
To verify that your development environment is working, you can run the unit tests::
9998

100-
$ python -m pytest -v zarr
99+
$ python -m pytest -v tests
101100

102101
Creating a branch
103102
~~~~~~~~~~~~~~~~~
@@ -149,7 +148,7 @@ and invoke::
149148
Some tests require optional dependencies to be installed, otherwise
150149
the tests will be skipped. To install all optional dependencies, run::
151150

152-
$ pip install -r requirements_dev_optional.txt
151+
$ pip install pytest-doctestplus
153152

154153
To also run the doctests within docstrings (requires optional
155154
dependencies to be installed), run::
@@ -234,7 +233,7 @@ should run and pass as doctests under Python 3.8. To run doctests,
234233
activate your development environment, install optional requirements,
235234
and run::
236235

237-
$ python -m pytest -v --doctest-plus zarr
236+
$ python -m pytest -v --doctest-plus tests
238237

239238
Zarr uses Sphinx for documentation, hosted on readthedocs.org. Documentation is
240239
written in the RestructuredText markup language (.rst files) in the ``docs`` folder.

docs/installation.rst

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
Installation
22
============
33

4-
Zarr depends on NumPy. It is generally best to `install NumPy
5-
<https://numpy.org/doc/stable/user/install.html>`_ first using whatever method is most
6-
appropriate for your operating system and Python distribution. Other dependencies should be
7-
installed automatically if using one of the installation methods below.
4+
pip
5+
---
86

9-
Note: Zarr has endorsed `Scientific-Python SPEC 0 <https://scientific-python.org/specs/spec-0000/>`_ and now follows the version support window as outlined below:
7+
.. code-block:: console
108
11-
- Python: 36 months after initial release
12-
- Core package dependencies (e.g. NumPy): 24 months after initial release
9+
$ pip install zarr
1310
14-
Install Zarr from PyPI::
11+
There are a number of optional dependency groups you can install for extra functionality.
12+
These can be installed using ``pip install "zarr[<extra>]"``, e.g. ``pip install "zarr[gpu]"``
1513

16-
$ pip install zarr
14+
- ``gpu``: support for GPUs
15+
- ``fsspec``: support for reading/writing to remote data stores
16+
- ``tree``: support for pretty printing of directory trees
1717

18-
Alternatively, install Zarr via conda::
18+
conda
19+
-----
20+
21+
.. code-block:: console
1922
2023
$ conda install -c conda-forge zarr
2124
22-
To install the latest development version of Zarr, you can use pip with the
23-
latest GitHub main::
25+
Conda does not support optional dependencies, so you will have to manually install any packages
26+
needed to enable extra functionality.
27+
28+
Dependency support
29+
------------------
30+
Zarr has endorsed `Scientific-Python SPEC 0 <https://scientific-python.org/specs/spec-0000/>`_ and now follows the version support window as outlined below:
2431

25-
$ pip install git+https://github.com/zarr-developers/zarr-python.git
32+
- Python: 36 months after initial release
33+
- Core package dependencies (e.g. NumPy): 24 months after initial release
2634

27-
To work with Zarr source code in development, see `Contributing <contributing.html>`_.
35+
Development
36+
-----------
37+
To install the latest development version of Zarr, see `the contributing guide <contributing.html>`_.

docs/release.rst

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,32 @@ Release notes
1818
See `GH1777 <https://github.com/zarr-developers/zarr-python/issues/1777>`_ for more details on the upcoming
1919
3.0 release.
2020

21+
.. release_3.0.0-beta:
22+
23+
3.0.0-beta series
24+
-----------------
25+
26+
.. warning::
27+
Zarr-Python 3.0.0-beta is a pre-release of the upcoming 3.0 release. This release is not feature complete or
28+
expected to be ready for production applications.
29+
30+
.. note::
31+
The complete release notes for 3.0 have not been added to this document yet. See the
32+
`3.0.0-beta <https://github.com/zarr-developers/zarr-python/releases/tag/v3.0.0-beta>`_ release on GitHub
33+
for a record of changes included in this release.
34+
35+
Dependency Changes
36+
~~~~~~~~~~~~~~~~~~
37+
38+
* fsspec was moved from a required dependency to an optional one. Users should install
39+
fsspec and any relevant implementations (e.g. s3fs) before using the ``RemoteStore``.
40+
By :user:`Joe Hamman <jhamman>` :issue:`2391`.
41+
42+
2143
.. release_3.0.0-alpha:
2244
23-
3.0.0-alpha
24-
-----------
45+
3.0.0-alpha series
46+
------------------
2547

2648
.. warning::
2749
Zarr-Python 3.0.0-alpha is a pre-release of the upcoming 3.0 release. This release is not feature complete or

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ requires-python = ">=3.11"
2828
dependencies = [
2929
'numpy>=1.25',
3030
'numcodecs[crc32c]>=0.14',
31-
'fsspec>=2022.10.0',
32-
'typing_extensions>=4.6',
31+
'typing_extensions>=4.9',
3332
'donfig>=0.8',
3433
]
3534

@@ -54,16 +53,16 @@ license = {text = "MIT License"}
5453
keywords = ["Python", "compressed", "ndimensional-arrays", "zarr"]
5554

5655
[project.optional-dependencies]
56+
fsspec = [
57+
"fsspec>=2023.10.0",
58+
]
5759
test = [
5860
"coverage",
5961
"pytest",
6062
"pytest-cov",
61-
"msgpack",
6263
"s3fs",
6364
"pytest-asyncio",
6465
"moto[s3]",
65-
"flask-cors",
66-
"flask",
6766
"requests",
6867
"mypy",
6968
"hypothesis",
@@ -224,7 +223,7 @@ dependencies = [
224223
'fsspec==2022.10.0',
225224
's3fs==2022.10.0',
226225
'universal_pathlib==0.0.22',
227-
'typing_extensions==4.6.*', # 4.5 needed for @deprecated, 4.6 for Buffer
226+
'typing_extensions==4.9.*',
228227
'donfig==0.8.*',
229228
# test deps
230229
'hypothesis',
@@ -342,6 +341,7 @@ ignore_errors = true
342341

343342
[[tool.mypy.overrides]]
344343
module = [
344+
"zarr.testing.stateful", # lots of hypothesis decorator errors
345345
"tests.package_with_entrypoint.*",
346346
"tests.test_codecs.test_codecs",
347347
"tests.test_codecs.test_transpose",

src/zarr/api/asynchronous.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import numpy as np
99
import numpy.typing as npt
10+
from typing_extensions import deprecated
1011

1112
from zarr.core.array import Array, AsyncArray, get_array_metadata
1213
from zarr.core.buffer import NDArrayLike
@@ -493,8 +494,29 @@ async def save_group(
493494
await asyncio.gather(*aws)
494495

495496

496-
async def tree(*args: Any, **kwargs: Any) -> None:
497-
raise NotImplementedError
497+
@deprecated("Use AsyncGroup.tree instead.")
498+
async def tree(grp: AsyncGroup, expand: bool | None = None, level: int | None = None) -> Any:
499+
"""Provide a rich display of the hierarchy.
500+
501+
Parameters
502+
----------
503+
grp : Group
504+
Zarr or h5py group.
505+
expand : bool, optional
506+
Only relevant for HTML representation. If True, tree will be fully expanded.
507+
level : int, optional
508+
Maximum depth to descend into hierarchy.
509+
510+
Returns
511+
-------
512+
TreeRepr
513+
A pretty-printable object displaying the hierarchy.
514+
515+
.. deprecated:: 3.0.0
516+
`zarr.tree()` is deprecated and will be removed in a future release.
517+
Use `group.tree()` instead.
518+
"""
519+
return await grp.tree(expand=expand, level=level)
498520

499521

500522
async def array(

src/zarr/api/synchronous.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import TYPE_CHECKING, Any, Literal
44

5+
from typing_extensions import deprecated
6+
57
import zarr.api.asynchronous as async_api
68
from zarr._compat import _deprecate_positional_args
79
from zarr.core.array import Array, AsyncArray
@@ -155,8 +157,9 @@ def save_group(
155157
)
156158

157159

158-
def tree(*args: Any, **kwargs: Any) -> None:
159-
return sync(async_api.tree(*args, **kwargs))
160+
@deprecated("Use Group.tree instead.")
161+
def tree(grp: Group, expand: bool | None = None, level: int | None = None) -> Any:
162+
return sync(async_api.tree(grp._async_group, expand=expand, level=level))
160163

161164

162165
# TODO: add type annotations for kwargs

src/zarr/core/chunk_grids.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ def normalize_chunks(chunks: Any, shape: tuple[int, ...], typesize: int) -> tupl
138138
s if c == -1 or c is None else int(c) for s, c in zip(shape, chunks, strict=False)
139139
)
140140

141+
if not all(isinstance(c, numbers.Integral) for c in chunks):
142+
raise TypeError("non integer value in chunks")
143+
141144
return tuple(int(c) for c in chunks)
142145

143146

src/zarr/core/group.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ async def tree(self, expand: bool | None = None, level: int | None = None) -> An
14491449
from zarr.core._tree import group_tree_async
14501450

14511451
if expand is not None:
1452-
raise NotImplementedError("'expanded' is not yet implemented.")
1452+
raise NotImplementedError("'expand' is not yet implemented.")
14531453
return await group_tree_async(self, max_depth=level)
14541454

14551455
async def empty(
@@ -1847,8 +1847,8 @@ def __repr__(self) -> str:
18471847
async def update_attributes_async(self, new_attributes: dict[str, Any]) -> Group:
18481848
"""Update the attributes of this group.
18491849
1850-
Example
1851-
-------
1850+
Examples
1851+
--------
18521852
>>> import zarr
18531853
>>> group = zarr.group()
18541854
>>> await group.update_attributes_async({"foo": "bar"})
@@ -1947,8 +1947,9 @@ def synchronizer(self) -> None:
19471947

19481948
def update_attributes(self, new_attributes: dict[str, Any]) -> Group:
19491949
"""Update the attributes of this group.
1950-
Example
1951-
-------
1950+
1951+
Examples
1952+
--------
19521953
>>> import zarr
19531954
>>> group = zarr.group()
19541955
>>> group.update_attributes({"foo": "bar"})
@@ -2027,8 +2028,8 @@ def __contains__(self, member: str) -> bool:
20272028
def groups(self) -> Generator[tuple[str, Group], None]:
20282029
"""Return the sub-groups of this group as a generator of (name, group) pairs.
20292030
2030-
Example
2031-
-------
2031+
Examples
2032+
--------
20322033
>>> import zarr
20332034
>>> group = zarr.group()
20342035
>>> group.create_group("subgroup")

0 commit comments

Comments
 (0)