Skip to content

Commit 650c6f3

Browse files
authored
Merge branch 'main' into improve-dtype-docs
2 parents e9f6af6 + 8405073 commit 650c6f3

5 files changed

Lines changed: 40 additions & 40 deletions

File tree

changes/2819.chore.rst

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

docs/conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,17 @@ def skip_submodules(
167167
# documentation.
168168
html_theme_options = {
169169
"github_url": "https://github.com/zarr-developers/zarr-python",
170-
"twitter_url": "https://twitter.com/zarr_dev",
171170
"icon_links": [
171+
{
172+
"name": "Bluesky",
173+
"url": "https://bsky.app/profile/zarr.dev",
174+
"icon": "fa-brands fa-bluesky",
175+
},
176+
{
177+
"name": "Mastodon",
178+
"url": "https://fosstodon.org/@zarr",
179+
"icon": "fa-brands fa-mastodon",
180+
},
172181
{
173182
"name": "Zarr Dev",
174183
"url": "https://zarr.dev/",
@@ -178,7 +187,6 @@ def skip_submodules(
178187
],
179188
"collapse_navigation": True,
180189
"navigation_with_keys": False,
181-
"announcement": "Zarr-Python 3 is here! Check out the release announcement <a href='https://zarr.dev/blog/zarr-python-3-release/'>here.</a>",
182190
}
183191

184192
# Add any paths that contain custom themes here, relative to this directory.

docs/release-notes.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,24 @@ Release notes
88

99
Features
1010
~~~~~~~~
11-
11+
- Ensure that invocations of ``create_array`` use consistent keyword arguments, with consistent defaults.
12+
13+
``zarr.api.synchronous.create_array`` now takes a ``write_data`` keyword argument
14+
The ``Group.create_array`` method takes ``data`` and ``write_data`` keyword arguments.
15+
The functions ``api.asynchronous.create``, ``api.asynchronous.create_array``
16+
and the methods ``Group.create_array``, ``Group.array``, had the default
17+
``fill_value`` changed from ``0`` to the ``DEFAULT_FILL_VALUE`` value, which instructs Zarr to
18+
use the default scalar value associated with the array's data type as the fill value. These are
19+
all functions or methods for array creation that mirror, wrap or are wrapped by, another function
20+
that already has a default ``fill_value`` set to ``DEFAULT_FILL_VALUE``. This change is necessary
21+
to make these functions consistent across the entire codebase, but as this changes default values,
22+
new data might have a different fill value than expected after this change.
23+
24+
For data types where 0 is meaningful, like integers or floats, the default scalar is 0, so this
25+
change should not be noticeable. For data types where 0 is ambiguous, like fixed-length unicode
26+
strings, the default fill value might be different after this change. Users who were relying on how
27+
Zarr interpreted ``0`` as a non-numeric scalar value should set their desired fill value explicitly
28+
after this change.
1229
- Added public API for Buffer ABCs and implementations.
1330

1431
Use :mod:`zarr.buffer` to access buffer implementations, and

tests/package_with_entrypoint/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Any, Literal, Self
3+
from typing import TYPE_CHECKING
44

55
import numpy as np
66
import numpy.typing as npt
@@ -14,7 +14,7 @@
1414

1515
if TYPE_CHECKING:
1616
from collections.abc import Iterable
17-
from typing import ClassVar, Literal
17+
from typing import Any, ClassVar, Literal, Self
1818

1919
from zarr.core.array_spec import ArraySpec
2020
from zarr.core.common import ZarrFormat

tests/test_api.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
from __future__ import annotations
22

33
import inspect
4-
import pathlib
54
import re
65
from typing import TYPE_CHECKING
76

87
import zarr.codecs
98
import zarr.storage
109

1110
if TYPE_CHECKING:
12-
import pathlib
1311
from collections.abc import Callable
12+
from pathlib import Path
1413

1514
from zarr.abc.store import Store
1615
from zarr.core.common import JSON, MemoryOrder, ZarrFormat
@@ -45,10 +44,6 @@
4544
from zarr.storage._utils import normalize_path
4645
from zarr.testing.utils import gpu_test
4746

48-
if TYPE_CHECKING:
49-
from collections.abc import Callable
50-
from pathlib import Path
51-
5247

5348
def test_create(memory_store: Store) -> None:
5449
store = memory_store
@@ -209,9 +204,7 @@ async def test_open_group(memory_store: MemoryStore) -> None:
209204

210205

211206
@pytest.mark.parametrize("zarr_format", [None, 2, 3])
212-
async def test_open_group_unspecified_version(
213-
tmpdir: pathlib.Path, zarr_format: ZarrFormat
214-
) -> None:
207+
async def test_open_group_unspecified_version(tmpdir: Path, zarr_format: ZarrFormat) -> None:
215208
"""Regression test for https://github.com/zarr-developers/zarr-python/issues/2175"""
216209

217210
# create a group with specified zarr format (could be 2, 3, or None)
@@ -272,7 +265,7 @@ def test_save_errors() -> None:
272265
zarr.save("data/example.zarr", a, mode="w")
273266

274267

275-
def test_open_with_mode_r(tmp_path: pathlib.Path) -> None:
268+
def test_open_with_mode_r(tmp_path: Path) -> None:
276269
# 'r' means read only (must exist)
277270
with pytest.raises(FileNotFoundError):
278271
zarr.open(store=tmp_path, mode="r")
@@ -288,7 +281,7 @@ def test_open_with_mode_r(tmp_path: pathlib.Path) -> None:
288281
z2[:] = 3
289282

290283

291-
def test_open_with_mode_r_plus(tmp_path: pathlib.Path) -> None:
284+
def test_open_with_mode_r_plus(tmp_path: Path) -> None:
292285
# 'r+' means read/write (must exist)
293286
with pytest.raises(FileNotFoundError):
294287
zarr.open(store=tmp_path, mode="r+")
@@ -301,7 +294,7 @@ def test_open_with_mode_r_plus(tmp_path: pathlib.Path) -> None:
301294
z2[:] = 3
302295

303296

304-
async def test_open_with_mode_a(tmp_path: pathlib.Path) -> None:
297+
async def test_open_with_mode_a(tmp_path: Path) -> None:
305298
# Open without shape argument should default to group
306299
g = zarr.open(store=tmp_path, mode="a")
307300
assert isinstance(g, Group)
@@ -319,7 +312,7 @@ async def test_open_with_mode_a(tmp_path: pathlib.Path) -> None:
319312
z2[:] = 3
320313

321314

322-
def test_open_with_mode_w(tmp_path: pathlib.Path) -> None:
315+
def test_open_with_mode_w(tmp_path: Path) -> None:
323316
# 'w' means create (overwrite if exists);
324317
arr = zarr.open(store=tmp_path, mode="w", shape=(3, 3))
325318
assert isinstance(arr, Array)
@@ -333,7 +326,7 @@ def test_open_with_mode_w(tmp_path: pathlib.Path) -> None:
333326
z2[:] = 3
334327

335328

336-
def test_open_with_mode_w_minus(tmp_path: pathlib.Path) -> None:
329+
def test_open_with_mode_w_minus(tmp_path: Path) -> None:
337330
# 'w-' means create (fail if exists)
338331
arr = zarr.open(store=tmp_path, mode="w-", shape=(3, 3))
339332
assert isinstance(arr, Array)
@@ -405,7 +398,7 @@ def test_load_array(sync_store: Store) -> None:
405398

406399
@pytest.mark.parametrize("path", ["data", None])
407400
@pytest.mark.parametrize("load_read_only", [True, False, None])
408-
def test_load_zip(tmp_path: pathlib.Path, path: str | None, load_read_only: bool | None) -> None:
401+
def test_load_zip(tmp_path: Path, path: str | None, load_read_only: bool | None) -> None:
409402
file = tmp_path / "test.zip"
410403
data = np.arange(100).reshape(10, 10)
411404

@@ -423,7 +416,7 @@ def test_load_zip(tmp_path: pathlib.Path, path: str | None, load_read_only: bool
423416

424417
@pytest.mark.parametrize("path", ["data", None])
425418
@pytest.mark.parametrize("load_read_only", [True, False])
426-
def test_load_local(tmp_path: pathlib.Path, path: str | None, load_read_only: bool) -> None:
419+
def test_load_local(tmp_path: Path, path: str | None, load_read_only: bool) -> None:
427420
file = tmp_path / "test.zip"
428421
data = np.arange(100).reshape(10, 10)
429422

@@ -1139,7 +1132,7 @@ async def test_open_falls_back_to_open_group_async(zarr_format: ZarrFormat) -> N
11391132

11401133

11411134
@pytest.mark.parametrize("mode", ["r", "r+", "w", "a"])
1142-
def test_open_modes_creates_group(tmp_path: pathlib.Path, mode: str) -> None:
1135+
def test_open_modes_creates_group(tmp_path: Path, mode: str) -> None:
11431136
# https://github.com/zarr-developers/zarr-python/issues/2490
11441137
zarr_dir = tmp_path / f"mode-{mode}-test.zarr"
11451138
if mode in ["r", "r+"]:

0 commit comments

Comments
 (0)