Skip to content

Commit 1daf5f3

Browse files
committed
Merge remote-tracking branch 'upstream/v3' into user/tom/fix/v2-no-fill-value
2 parents 3bf3622 + a24e194 commit 1daf5f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+374
-255
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 }}

.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.6.7
10+
rev: v0.6.8
1111
hooks:
1212
- id: ruff
1313
args: ["--fix", "--show-fixes"]

docs/_static/custom.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618
7474
.sd-card .sd-card-header {
7575
border: none;
7676
background-color: white;
77-
color: #150458 !important;
7877
font-size: var(--pst-font-size-h5);
7978
font-weight: bold;
8079
padding: 2.5rem 0rem 0.5rem 0rem;
@@ -107,7 +106,6 @@ html[data-theme=dark] .sd-shadow-sm {
107106

108107
html[data-theme=dark] .sd-card .sd-card-header {
109108
background-color:var(--pst-color-background);
110-
color: #150458 !important;
111109
}
112110

113111
html[data-theme=dark] .sd-card .sd-card-footer {

docs/_static/custom.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"highlights": "getting_started.html#highlights",
77
"contributing": "contributing.html",
88
"projects-using-zarr": "getting_started.html#projects-using-zarr",
9-
"acknowledgments": "acknowledgments.html",
109
"contents": "getting_started.html#contents",
1110
"indices-and-tables": "api.html#indices-and-tables"
1211
}

docs/acknowledgments.rst

Lines changed: 0 additions & 76 deletions
This file was deleted.

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ def setup(app: sphinx.application.Sphinx) -> None:
255255
# Output file base name for HTML help builder.
256256
htmlhelp_basename = "zarrdoc"
257257

258+
maximum_signature_line_length = 80
259+
258260
# -- Options for LaTeX output ---------------------------------------------
259261

260262
latex_elements = {

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Zarr-Python
1414
spec
1515
release
1616
license
17-
acknowledgments
1817
contributing
1918

2019
**Version**: |version|

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ gpu = [
7878
"cupy-cuda12x",
7979
]
8080
docs = [
81-
'sphinx==7.4.7',
81+
'sphinx==8.0.2',
8282
'sphinx-autobuild>=2021.3.14',
83-
'sphinx-autoapi==3.3.1',
83+
'sphinx-autoapi==3.3.2',
8484
'sphinx_design',
8585
'sphinx-issues',
8686
'sphinx-copybutton',

src/zarr/abc/codec.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from zarr.core.indexing import SelectorTuple
2121

2222
__all__ = [
23+
"BaseCodec",
2324
"ArrayArrayCodec",
2425
"ArrayBytesCodec",
2526
"ArrayBytesCodecPartialDecodeMixin",
@@ -34,11 +35,15 @@
3435
CodecOutput = TypeVar("CodecOutput", bound=NDBuffer | Buffer)
3536

3637

37-
class _Codec(Metadata, Generic[CodecInput, CodecOutput]):
38+
class BaseCodec(Metadata, Generic[CodecInput, CodecOutput]):
3839
"""Generic base class for codecs.
39-
Please use ArrayArrayCodec, ArrayBytesCodec or BytesBytesCodec for subclassing.
4040
4141
Codecs can be registered via zarr.codecs.registry.
42+
43+
Warnings
44+
--------
45+
This class is not intended to be directly, please use
46+
ArrayArrayCodec, ArrayBytesCodec or BytesBytesCodec for subclassing.
4247
"""
4348

4449
is_fixed_size: bool
@@ -148,19 +153,19 @@ async def encode(
148153
return await _batching_helper(self._encode_single, chunks_and_specs)
149154

150155

151-
class ArrayArrayCodec(_Codec[NDBuffer, NDBuffer]):
156+
class ArrayArrayCodec(BaseCodec[NDBuffer, NDBuffer]):
152157
"""Base class for array-to-array codecs."""
153158

154159
...
155160

156161

157-
class ArrayBytesCodec(_Codec[NDBuffer, Buffer]):
162+
class ArrayBytesCodec(BaseCodec[NDBuffer, Buffer]):
158163
"""Base class for array-to-bytes codecs."""
159164

160165
...
161166

162167

163-
class BytesBytesCodec(_Codec[Buffer, Buffer]):
168+
class BytesBytesCodec(BaseCodec[Buffer, Buffer]):
164169
"""Base class for bytes-to-bytes codecs."""
165170

166171
...

src/zarr/api/asynchronous.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
import numpy as np
88
import numpy.typing as npt
99

10+
from zarr.abc.store import Store
1011
from zarr.core.array import Array, AsyncArray, get_array_metadata
1112
from zarr.core.common import JSON, AccessModeLiteral, ChunkCoords, MemoryOrder, ZarrFormat
1213
from zarr.core.config import config
1314
from zarr.core.group import AsyncGroup
1415
from zarr.core.metadata.v2 import ArrayV2Metadata
1516
from zarr.core.metadata.v3 import ArrayV3Metadata
16-
from zarr.store import (
17+
from zarr.storage import (
1718
StoreLike,
19+
StorePath,
1820
make_store_path,
1921
)
2022

@@ -225,6 +227,7 @@ async def open(
225227
Return type depends on what exists in the given store.
226228
"""
227229
zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
230+
228231
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
229232

230233
if path is not None:
@@ -243,9 +246,9 @@ async def open(
243246
return await open_group(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
244247

245248
try:
246-
return await open_array(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
249+
return await open_array(store=store_path, zarr_format=zarr_format, **kwargs)
247250
except KeyError:
248-
return await open_group(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
251+
return await open_group(store=store_path, zarr_format=zarr_format, **kwargs)
249252

250253

251254
async def open_consolidated(*args: Any, **kwargs: Any) -> AsyncGroup:
@@ -319,7 +322,8 @@ async def save_array(
319322
or _default_zarr_version()
320323
)
321324

322-
store_path = await make_store_path(store, mode="w", storage_options=storage_options)
325+
mode = kwargs.pop("mode", None)
326+
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
323327
if path is not None:
324328
store_path = store_path / path
325329
new = await AsyncArray.create(
@@ -496,7 +500,9 @@ async def group(
496500

497501
zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
498502

499-
store_path = await make_store_path(store, storage_options=storage_options)
503+
mode = None if isinstance(store, Store) else cast(AccessModeLiteral, "a")
504+
505+
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
500506
if path is not None:
501507
store_path = store_path / path
502508

@@ -769,7 +775,11 @@ async def create(
769775
if meta_array is not None:
770776
warnings.warn("meta_array is not yet implemented", RuntimeWarning, stacklevel=2)
771777

772-
mode = kwargs.pop("mode", cast(AccessModeLiteral, "r" if read_only else "w"))
778+
mode = kwargs.pop("mode", None)
779+
if mode is None:
780+
if not isinstance(store, Store | StorePath):
781+
mode = "a"
782+
773783
store_path = await make_store_path(store, mode=mode, storage_options=storage_options)
774784
if path is not None:
775785
store_path = store_path / path
@@ -945,7 +955,8 @@ async def open_array(
945955
The opened array.
946956
"""
947957

948-
store_path = await make_store_path(store, storage_options=storage_options)
958+
mode = kwargs.pop("mode", None)
959+
store_path = await make_store_path(store, mode=mode)
949960
if path is not None:
950961
store_path = store_path / path
951962

0 commit comments

Comments
 (0)