Skip to content

Commit 25c7689

Browse files
authored
Mandate kwargs on to_zarr (#8257)
* Mandate kwargs on `to_zarr` This aleviates some of the dangers of having these in a different order between `da` & `ds`. _Technically_ it's a breaking change, but only very technically, given that I would wager literally no one has a dozen positional arguments to this method. So I think it's OK.
1 parent 8d54acf commit 25c7689

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

doc/whats-new.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ New Features
3030
Breaking changes
3131
~~~~~~~~~~~~~~~~
3232

33+
- :py:meth:`Dataset.to_zarr` & :py:meth:`DataArray.to_zarr` require keyword
34+
arguments after the initial 7 positional arguments.
35+
By `Maximilian Roos <https://github.com/max-sixty>`_.
36+
3337

3438
Deprecations
3539
~~~~~~~~~~~~

xarray/backends/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,7 @@ def to_zarr(
15281528
synchronizer=None,
15291529
group: str | None = None,
15301530
encoding: Mapping | None = None,
1531+
*,
15311532
compute: Literal[True] = True,
15321533
consolidated: bool | None = None,
15331534
append_dim: Hashable | None = None,
@@ -1573,6 +1574,7 @@ def to_zarr(
15731574
synchronizer=None,
15741575
group: str | None = None,
15751576
encoding: Mapping | None = None,
1577+
*,
15761578
compute: bool = True,
15771579
consolidated: bool | None = None,
15781580
append_dim: Hashable | None = None,

xarray/core/dataarray.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4010,6 +4010,7 @@ def to_zarr(
40104010
mode: Literal["w", "w-", "a", "r+", None] = None,
40114011
synchronizer=None,
40124012
group: str | None = None,
4013+
*,
40134014
encoding: Mapping | None = None,
40144015
compute: Literal[True] = True,
40154016
consolidated: bool | None = None,
@@ -4050,6 +4051,7 @@ def to_zarr(
40504051
synchronizer=None,
40514052
group: str | None = None,
40524053
encoding: Mapping | None = None,
4054+
*,
40534055
compute: bool = True,
40544056
consolidated: bool | None = None,
40554057
append_dim: Hashable | None = None,

xarray/core/dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,7 @@ def to_zarr(
22932293
synchronizer=None,
22942294
group: str | None = None,
22952295
encoding: Mapping | None = None,
2296+
*,
22962297
compute: Literal[True] = True,
22972298
consolidated: bool | None = None,
22982299
append_dim: Hashable | None = None,
@@ -2336,6 +2337,7 @@ def to_zarr(
23362337
synchronizer=None,
23372338
group: str | None = None,
23382339
encoding: Mapping | None = None,
2340+
*,
23392341
compute: bool = True,
23402342
consolidated: bool | None = None,
23412343
append_dim: Hashable | None = None,

0 commit comments

Comments
 (0)