Skip to content

Commit fae90f9

Browse files
authored
Merge branch 'main' into rm-spec-docs
2 parents e94e3a9 + c0f7ece commit fae90f9

File tree

20 files changed

+381
-102
lines changed

20 files changed

+381
-102
lines changed

.github/workflows/releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
with:
5656
name: releases
5757
path: dist
58-
- uses: pypa/[email protected].2
58+
- uses: pypa/[email protected].3
5959
with:
6060
user: __token__
6161
password: ${{ secrets.pypi_password }}

docs/contributing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Contributing to Zarr
2-
====================
1+
Contributing
2+
============
33

44
Zarr is a community maintained project. We welcome contributions in the form of bug
55
reports, bug fixes, documentation, enhancement proposals and more. This page provides

docs/guide/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ Guide
44
.. toctree::
55
:maxdepth: 1
66

7+
whatsnew_v3
78
storage
89
consolidated_metadata

docs/guide/whatsnew_v3.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
What's new in v3
2+
================
3+
4+
This page gives an overview of major changes and additions in version 3.
5+
6+
7+
Dependencies
8+
------------
9+
- The new ``remote`` dependency group can be used to install a supported version of
10+
``fsspec``, required for remote data access.
11+
- The new ``gpu`` dependency group can be used to install a supported version of
12+
``cuda``, required for GPU functionality.
13+
- The ``jupyter`` optional dependency group has been removed, since v3 contains no
14+
jupyter specific functionality.

docs/release.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Dependency Changes
3939
fsspec and any relevant implementations (e.g. s3fs) before using the ``RemoteStore``.
4040
By :user:`Joe Hamman <jhamman>` :issue:`2391`.
4141

42+
* ``RemoteStore`` was renamed to ``FsspecStore``.
43+
By :user:`Joe Hamman <jhamman>` :issue:`2557`.
4244

4345
.. release_3.0.0-alpha:
4446

pyproject.toml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ license = {text = "MIT License"}
5353
keywords = ["Python", "compressed", "ndimensional-arrays", "zarr"]
5454

5555
[project.optional-dependencies]
56-
fsspec = [
56+
# User extras
57+
remote = [
5758
"fsspec>=2023.10.0",
5859
]
60+
gpu = [
61+
"cupy-cuda12x",
62+
]
63+
# Development extras
5964
test = [
6065
"coverage",
6166
"pytest",
@@ -68,15 +73,7 @@ test = [
6873
"hypothesis",
6974
"universal-pathlib",
7075
]
71-
72-
jupyter = [
73-
'notebook',
74-
'ipytree>=0.2.2',
75-
'ipywidgets>=8.0.0',
76-
]
77-
gpu = [
78-
"cupy-cuda12x",
79-
]
76+
optional = ["rich", "universal-pathlib"]
8077
docs = [
8178
'sphinx==8.1.3',
8279
'sphinx-autobuild>=2021.3.14',
@@ -88,19 +85,9 @@ docs = [
8885
'pydata-sphinx-theme',
8986
'numpydoc',
9087
'numcodecs[msgpack]',
91-
'msgpack',
92-
]
93-
extra = [
94-
'msgpack',
95-
]
96-
optional = [
97-
'universal-pathlib>=0.0.22',
98-
'rich'
99-
]
100-
tree = [
101-
'rich',
10288
]
10389

90+
10491
[project.urls]
10592
"Bug Tracker" = "https://github.com/zarr-developers/zarr-python/issues"
10693
Changelog = "https://zarr.readthedocs.io/en/stable/release.html"
@@ -130,7 +117,7 @@ dependencies = [
130117
"numpy~={matrix:numpy}",
131118
"universal_pathlib",
132119
]
133-
features = ["test", "extra"]
120+
features = ["test"]
134121

135122
[[tool.hatch.envs.test.matrix]]
136123
python = ["3.11", "3.12", "3.13"]
@@ -161,7 +148,7 @@ dependencies = [
161148
"numpy~={matrix:numpy}",
162149
"universal_pathlib",
163150
]
164-
features = ["test", "extra", "gpu"]
151+
features = ["test", "gpu"]
165152

166153
[[tool.hatch.envs.gputest.matrix]]
167154
python = ["3.11", "3.12", "3.13"]
@@ -377,6 +364,7 @@ filterwarnings = [
377364
"ignore:The loop argument is deprecated since Python 3.8.*:DeprecationWarning",
378365
"ignore:Creating a zarr.buffer.gpu.*:UserWarning",
379366
"ignore:Duplicate name:UserWarning", # from ZipFile
367+
"ignore:.*is currently not part in the Zarr version 3 specification.*:UserWarning",
380368
]
381369
markers = [
382370
"gpu: mark a test as requiring CuPy and GPU"

src/zarr/api/asynchronous.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ async def consolidate_metadata(
195195
v = dataclasses.replace(v, consolidated_metadata=ConsolidatedMetadata(metadata={}))
196196
members_metadata[k] = v
197197

198+
if any(m.zarr_format == 3 for m in members_metadata.values()):
199+
warnings.warn(
200+
"Consolidated metadata is currently not part in the Zarr version 3 specification. It "
201+
"may not be supported by other zarr implementations and may change in the future.",
202+
category=UserWarning,
203+
stacklevel=1,
204+
)
205+
198206
ConsolidatedMetadata._flat_to_nested(members_metadata)
199207

200208
consolidated_metadata = ConsolidatedMetadata(metadata=members_metadata)
@@ -203,6 +211,7 @@ async def consolidate_metadata(
203211
group,
204212
metadata=metadata,
205213
)
214+
206215
await group._save_metadata()
207216
return group
208217

src/zarr/codecs/vlen_utf8.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from dataclasses import dataclass
44
from typing import TYPE_CHECKING
5+
from warnings import warn
56

67
import numpy as np
78
from numcodecs.vlen import VLenBytes, VLenUTF8
@@ -25,6 +26,15 @@
2526

2627
@dataclass(frozen=True)
2728
class VLenUTF8Codec(ArrayBytesCodec):
29+
def __init__(self) -> None:
30+
warn(
31+
"The codec `vlen-utf8` is currently not part in the Zarr version 3 specification. It "
32+
"may not be supported by other zarr implementations and may change in the future.",
33+
category=UserWarning,
34+
stacklevel=2,
35+
)
36+
super().__init__()
37+
2838
@classmethod
2939
def from_dict(cls, data: dict[str, JSON]) -> Self:
3040
_, configuration_parsed = parse_named_configuration(
@@ -71,6 +81,15 @@ def compute_encoded_size(self, input_byte_length: int, _chunk_spec: ArraySpec) -
7181

7282
@dataclass(frozen=True)
7383
class VLenBytesCodec(ArrayBytesCodec):
84+
def __init__(self) -> None:
85+
warn(
86+
"The codec `vlen-bytes` is currently not part in the Zarr version 3 specification. It "
87+
"may not be supported by other zarr implementations and may change in the future.",
88+
category=UserWarning,
89+
stacklevel=2,
90+
)
91+
super().__init__()
92+
7493
@classmethod
7594
def from_dict(cls, data: dict[str, JSON]) -> Self:
7695
_, configuration_parsed = parse_named_configuration(

src/zarr/core/array.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from itertools import starmap
77
from logging import getLogger
88
from typing import TYPE_CHECKING, Any, Generic, Literal, cast, overload
9+
from warnings import warn
910

1011
import numpy as np
1112
import numpy.typing as npt
@@ -539,7 +540,7 @@ async def _create_v3(
539540
store_path: StorePath,
540541
*,
541542
shape: ShapeLike,
542-
dtype: npt.DTypeLike,
543+
dtype: np.dtype[Any],
543544
chunk_shape: ChunkCoords,
544545
fill_value: Any | None = None,
545546
order: MemoryOrder | None = None,
@@ -580,6 +581,14 @@ async def _create_v3(
580581
else DefaultChunkKeyEncoding(separator=chunk_key_encoding[1])
581582
)
582583

584+
if dtype.kind in "UTS":
585+
warn(
586+
f"The dtype `{dtype}` is currently not part in the Zarr version 3 specification. It "
587+
"may not be supported by other zarr implementations and may change in the future.",
588+
category=UserWarning,
589+
stacklevel=2,
590+
)
591+
583592
metadata = ArrayV3Metadata(
584593
shape=shape,
585594
data_type=dtype,
@@ -601,7 +610,7 @@ async def _create_v2(
601610
store_path: StorePath,
602611
*,
603612
shape: ChunkCoords,
604-
dtype: npt.DTypeLike,
613+
dtype: np.dtype[Any],
605614
chunks: ChunkCoords,
606615
dimension_separator: Literal[".", "/"] | None = None,
607616
fill_value: float | None = None,

src/zarr/core/metadata/v3.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ def validate_codecs(codecs: tuple[Codec, ...], dtype: DataType) -> None:
9595

9696
# we need to have special codecs if we are decoding vlen strings or bytestrings
9797
# TODO: use codec ID instead of class name
98-
codec_id = abc.__class__.__name__
99-
if dtype == DataType.string and not codec_id == "VLenUTF8Codec":
98+
codec_class_name = abc.__class__.__name__
99+
if dtype == DataType.string and not codec_class_name == "VLenUTF8Codec":
100100
raise ValueError(
101-
f"For string dtype, ArrayBytesCodec must be `VLenUTF8Codec`, got `{codec_id}`."
101+
f"For string dtype, ArrayBytesCodec must be `VLenUTF8Codec`, got `{codec_class_name}`."
102102
)
103-
if dtype == DataType.bytes and not codec_id == "VLenBytesCodec":
103+
if dtype == DataType.bytes and not codec_class_name == "VLenBytesCodec":
104104
raise ValueError(
105-
f"For bytes dtype, ArrayBytesCodec must be `VLenBytesCodec`, got `{codec_id}`."
105+
f"For bytes dtype, ArrayBytesCodec must be `VLenBytesCodec`, got `{codec_class_name}`."
106106
)
107107

108108

0 commit comments

Comments
 (0)