Skip to content

Commit 617e2cd

Browse files
authored
Move deprecation notices to the top of docstrings (#2637)
* Move deprecation notices to the top of docstrings * Turn off GL09
1 parent df18805 commit 617e2cd

File tree

5 files changed

+32
-27
lines changed

5 files changed

+32
-27
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ ignore = [
397397
checks = [
398398
"GL06",
399399
"GL07",
400-
"GL09",
400+
# Currently broken; see https://github.com/numpy/numpydoc/issues/573
401+
# "GL09",
401402
"GL10",
402403
"SS02",
403404
"SS04",

src/zarr/api/asynchronous.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ async def save_group(
508508
async def tree(grp: AsyncGroup, expand: bool | None = None, level: int | None = None) -> Any:
509509
"""Provide a rich display of the hierarchy.
510510
511+
.. deprecated:: 3.0.0
512+
`zarr.tree()` is deprecated and will be removed in a future release.
513+
Use `group.tree()` instead.
514+
511515
Parameters
512516
----------
513517
grp : Group
@@ -521,10 +525,6 @@ async def tree(grp: AsyncGroup, expand: bool | None = None, level: int | None =
521525
-------
522526
TreeRepr
523527
A pretty-printable object displaying the hierarchy.
524-
525-
.. deprecated:: 3.0.0
526-
`zarr.tree()` is deprecated and will be removed in a future release.
527-
Use `group.tree()` instead.
528528
"""
529529
return await grp.tree(expand=expand, level=level)
530530

src/zarr/api/synchronous.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ def save_group(
334334
def tree(grp: Group, expand: bool | None = None, level: int | None = None) -> Any:
335335
"""Provide a rich display of the hierarchy.
336336
337+
.. deprecated:: 3.0.0
338+
`zarr.tree()` is deprecated and will be removed in a future release.
339+
Use `group.tree()` instead.
340+
337341
Parameters
338342
----------
339343
grp : Group
@@ -347,10 +351,6 @@ def tree(grp: Group, expand: bool | None = None, level: int | None = None) -> An
347351
-------
348352
TreeRepr
349353
A pretty-printable object displaying the hierarchy.
350-
351-
.. deprecated:: 3.0.0
352-
`zarr.tree()` is deprecated and will be removed in a future release.
353-
Use `group.tree()` instead.
354354
"""
355355
return sync(async_api.tree(grp._async_group, expand=expand, level=level))
356356

src/zarr/core/array.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ async def create(
432432
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
433433
"""Method to create a new asynchronous array instance.
434434
435+
.. deprecated:: 3.0.0
436+
Deprecated in favor of :func:`zarr.api.asynchronous.create_array`.
437+
435438
Parameters
436439
----------
437440
store : StoreLike
@@ -509,9 +512,6 @@ async def create(
509512
-------
510513
AsyncArray
511514
The created asynchronous array instance.
512-
513-
.. deprecated:: 3.0.0
514-
Deprecated in favor of :func:`zarr.api.asynchronous.create_array`.
515515
"""
516516
return await cls._create(
517517
store,
@@ -1631,6 +1631,9 @@ def create(
16311631
) -> Array:
16321632
"""Creates a new Array instance from an initialized store.
16331633
1634+
.. deprecated:: 3.0.0
1635+
Deprecated in favor of :func:`zarr.create_array`.
1636+
16341637
Parameters
16351638
----------
16361639
store : StoreLike
@@ -1698,9 +1701,6 @@ def create(
16981701
-------
16991702
Array
17001703
Array created from the store.
1701-
1702-
.. deprecated:: 3.0.0
1703-
Deprecated in favor of :func:`zarr.create_array`.
17041704
"""
17051705
return cls._create(
17061706
store,

src/zarr/core/group.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,9 @@ async def create_dataset(
11481148
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
11491149
"""Create an array.
11501150
1151+
.. deprecated:: 3.0.0
1152+
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.create_array` instead.
1153+
11511154
Arrays are known as "datasets" in HDF5 terminology. For compatibility
11521155
with h5py, Zarr groups also implement the :func:`zarr.AsyncGroup.require_dataset` method.
11531156
@@ -1161,9 +1164,6 @@ async def create_dataset(
11611164
Returns
11621165
-------
11631166
a : AsyncArray
1164-
1165-
.. deprecated:: 3.0.0
1166-
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.create_array` instead.
11671167
"""
11681168
data = kwargs.pop("data", None)
11691169
# create_dataset in zarr 2.x requires shape but not dtype if data is
@@ -1188,6 +1188,9 @@ async def require_dataset(
11881188
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
11891189
"""Obtain an array, creating if it doesn't exist.
11901190
1191+
.. deprecated:: 3.0.0
1192+
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.require_dataset` instead.
1193+
11911194
Arrays are known as "datasets" in HDF5 terminology. For compatibility
11921195
with h5py, Zarr groups also implement the :func:`zarr.AsyncGroup.create_dataset` method.
11931196
@@ -1208,9 +1211,6 @@ async def require_dataset(
12081211
Returns
12091212
-------
12101213
a : AsyncArray
1211-
1212-
.. deprecated:: 3.0.0
1213-
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.require_dataset` instead.
12141214
"""
12151215
return await self.require_array(name, shape=shape, dtype=dtype, exact=exact, **kwargs)
12161216

@@ -2402,6 +2402,10 @@ def create_array(
24022402
def create_dataset(self, name: str, **kwargs: Any) -> Array:
24032403
"""Create an array.
24042404
2405+
.. deprecated:: 3.0.0
2406+
The h5py compatibility methods will be removed in 3.1.0. Use `Group.create_array` instead.
2407+
2408+
24052409
Arrays are known as "datasets" in HDF5 terminology. For compatibility
24062410
with h5py, Zarr groups also implement the :func:`zarr.Group.require_dataset` method.
24072411
@@ -2415,16 +2419,16 @@ def create_dataset(self, name: str, **kwargs: Any) -> Array:
24152419
Returns
24162420
-------
24172421
a : Array
2418-
2419-
.. deprecated:: 3.0.0
2420-
The h5py compatibility methods will be removed in 3.1.0. Use `Group.create_array` instead.
24212422
"""
24222423
return Array(self._sync(self._async_group.create_dataset(name, **kwargs)))
24232424

24242425
@deprecated("Use Group.require_array instead.")
24252426
def require_dataset(self, name: str, *, shape: ShapeLike, **kwargs: Any) -> Array:
24262427
"""Obtain an array, creating if it doesn't exist.
24272428
2429+
.. deprecated:: 3.0.0
2430+
The h5py compatibility methods will be removed in 3.1.0. Use `Group.require_array` instead.
2431+
24282432
Arrays are known as "datasets" in HDF5 terminology. For compatibility
24292433
with h5py, Zarr groups also implement the :func:`zarr.Group.create_dataset` method.
24302434
@@ -2440,9 +2444,6 @@ def require_dataset(self, name: str, *, shape: ShapeLike, **kwargs: Any) -> Arra
24402444
Returns
24412445
-------
24422446
a : Array
2443-
2444-
.. deprecated:: 3.0.0
2445-
The h5py compatibility methods will be removed in 3.1.0. Use `Group.require_array` instead.
24462447
"""
24472448
return Array(self._sync(self._async_group.require_array(name, shape=shape, **kwargs)))
24482449

@@ -2669,6 +2670,9 @@ def array(
26692670
) -> Array:
26702671
"""Create an array within this group.
26712672
2673+
.. deprecated:: 3.0.0
2674+
Use `Group.create_array` instead.
2675+
26722676
This method lightly wraps :func:`zarr.core.array.create_array`.
26732677
26742678
Parameters

0 commit comments

Comments
 (0)