Skip to content

Commit 2123df0

Browse files
committed
Merge branch 'main' into typing-test-store
2 parents 99835d6 + 00e7814 commit 2123df0

34 files changed

+308
-233
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ci:
66
default_stages: [pre-commit, pre-push]
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.12.7
9+
rev: v0.12.11
1010
hooks:
1111
- id: ruff-check
1212
args: ["--fix", "--show-fixes"]
@@ -17,7 +17,7 @@ repos:
1717
- id: codespell
1818
args: ["-L", "fo,ihs,kake,te", "-S", "fixture"]
1919
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v5.0.0
20+
rev: v6.0.0
2121
hooks:
2222
- id: check-yaml
2323
- id: trailing-whitespace
@@ -53,6 +53,6 @@ repos:
5353
hooks:
5454
- id: numpydoc-validation
5555
- repo: https://github.com/twisted/towncrier
56-
rev: 24.8.0
56+
rev: 25.8.0
5757
hooks:
5858
- id: towncrier-check

changes/2859.removal.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The ``Store.set_partial_writes`` method, which was not used by Zarr-Python, has been removed.
2+
``store.supports_partial_writes`` is now always ``False``.

changes/3403.misc.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Moves some indexing-specific exceptions to ``zarr.errors``, and ensures that all Zarr-specific
2+
exception classes accept a pre-formatted string as a single argument. This is a breaking change to
3+
the following exceptions classes: :class:`zarr.errors.BoundsCheckError`, :class:`zarr.errors.NegativeStepError`
4+
:class:`zarr.errors.VindexInvalidSelectionError`. These classes previously generated internally
5+
formatted error messages when given a single argument. After this change, formatting of the error
6+
message is up to the routine invoking the error.

changes/3411.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LocalStore now uses atomic writes, which should prevent some cases of corrupted data.

changes/3425.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ChunkGrid definition (broken in 3.1.2)

changes/3428.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure syntax like ``root['/subgroup']`` works equivalently to ``root['subgroup']`` when using consolidated metadata.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ testpaths = ["tests", "docs/user-guide"]
379379
log_cli_level = "INFO"
380380
xfail_strict = true
381381
asyncio_mode = "auto"
382+
asyncio_default_fixture_loop_scope = "function"
382383
doctest_optionflags = [
383384
"NORMALIZE_WHITESPACE",
384385
"ELLIPSIS",

src/zarr/abc/store.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
from asyncio import gather
55
from dataclasses import dataclass
66
from itertools import starmap
7-
from typing import TYPE_CHECKING, Protocol, runtime_checkable
7+
from typing import TYPE_CHECKING, Literal, Protocol, runtime_checkable
88

99
if TYPE_CHECKING:
1010
from collections.abc import AsyncGenerator, AsyncIterator, Iterable
1111
from types import TracebackType
1212
from typing import Any, Self, TypeAlias
1313

1414
from zarr.core.buffer import Buffer, BufferPrototype
15-
from zarr.core.common import BytesLike
1615

1716
__all__ = ["ByteGetter", "ByteSetter", "Store", "set_or_delete"]
1817

@@ -310,25 +309,12 @@ async def delete(self, key: str) -> None:
310309
...
311310

312311
@property
313-
@abstractmethod
314-
def supports_partial_writes(self) -> bool:
315-
"""Does the store support partial writes?"""
316-
...
317-
318-
@abstractmethod
319-
async def set_partial_values(
320-
self, key_start_values: Iterable[tuple[str, int, BytesLike]]
321-
) -> None:
322-
"""Store values at a given key, starting at byte range_start.
312+
def supports_partial_writes(self) -> Literal[False]:
313+
"""Does the store support partial writes?
323314
324-
Parameters
325-
----------
326-
key_start_values : list[tuple[str, int, BytesLike]]
327-
set of key, range_start, values triples, a key may occur multiple times with different
328-
range_starts, range_starts (considering the length of the respective values) must not
329-
specify overlapping ranges for the same key
315+
Partial writes are no longer used by Zarr, so this is always false.
330316
"""
331-
...
317+
return False
332318

333319
@property
334320
@abstractmethod
@@ -499,7 +485,7 @@ async def get(
499485
self, prototype: BufferPrototype, byte_range: ByteRequest | None = None
500486
) -> Buffer | None: ...
501487

502-
async def set(self, value: Buffer, byte_range: ByteRequest | None = None) -> None: ...
488+
async def set(self, value: Buffer) -> None: ...
503489

504490
async def delete(self) -> None: ...
505491

src/zarr/api/asynchronous.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,8 @@ async def open_group(
862862
overwrite=overwrite,
863863
attributes=attributes,
864864
)
865-
raise GroupNotFoundError(store, store_path.path)
865+
msg = f"No group found in store {store!r} at path {store_path.path!r}"
866+
raise GroupNotFoundError(msg)
866867

867868

868869
async def create(
@@ -1268,7 +1269,8 @@ async def open_array(
12681269
overwrite=overwrite,
12691270
**kwargs,
12701271
)
1271-
raise ArrayNotFoundError(store_path.store, store_path.path) from err
1272+
msg = f"No array found in store {store_path.store} at path {store_path.path}"
1273+
raise ArrayNotFoundError(msg) from err
12721274

12731275

12741276
async def open_like(

src/zarr/core/array.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ async def get_array_metadata(
257257
else:
258258
zarr_format = 2
259259
else:
260-
raise MetadataValidationError("zarr_format", "2, 3, or None", zarr_format)
260+
msg = f"Invalid value for 'zarr_format'. Expected 2, 3, or None. Got '{zarr_format}'." # type: ignore[unreachable]
261+
raise MetadataValidationError(msg)
261262

262263
metadata_dict: dict[str, JSON]
263264
if zarr_format == 2:

0 commit comments

Comments
 (0)