77from dataclasses import dataclass , field
88from itertools import starmap
99from logging import getLogger
10- from typing import TYPE_CHECKING , Any , Generic , Literal , TypeAlias , TypedDict , cast , overload
10+ from typing import (
11+ TYPE_CHECKING ,
12+ Any ,
13+ Generic ,
14+ Literal ,
15+ TypeAlias ,
16+ TypedDict ,
17+ cast ,
18+ overload ,
19+ )
1120from warnings import warn
1221
1322import numcodecs
1423import numpy as np
1524import numpy .typing as npt
25+ from typing_extensions import deprecated
1626
1727from zarr ._compat import _deprecate_positional_args
1828from zarr .abc .codec import ArrayArrayCodec , ArrayBytesCodec , BytesBytesCodec , Codec
@@ -274,7 +284,7 @@ def __init__(
274284 # this overload defines the function signature when zarr_format is 2
275285 @overload
276286 @classmethod
277- async def _create (
287+ async def create (
278288 cls ,
279289 store : StoreLike ,
280290 * ,
@@ -298,7 +308,7 @@ async def _create(
298308 # this overload defines the function signature when zarr_format is 3
299309 @overload
300310 @classmethod
301- async def _create (
311+ async def create (
302312 cls ,
303313 store : StoreLike ,
304314 * ,
@@ -326,7 +336,7 @@ async def _create(
326336
327337 @overload
328338 @classmethod
329- async def _create (
339+ async def create (
330340 cls ,
331341 store : StoreLike ,
332342 * ,
@@ -351,9 +361,10 @@ async def _create(
351361 data : npt .ArrayLike | None = None ,
352362 config : ArrayConfig | ArrayConfigParams | None = None ,
353363 ) -> AsyncArray [ArrayV3Metadata ]: ...
364+
354365 @overload
355366 @classmethod
356- async def _create (
367+ async def create (
357368 cls ,
358369 store : StoreLike ,
359370 * ,
@@ -386,8 +397,9 @@ async def _create(
386397 ) -> AsyncArray [ArrayV3Metadata ] | AsyncArray [ArrayV2Metadata ]: ...
387398
388399 @classmethod
389- # @deprecated("Use `zarr.api.asynchronous.create_array` instead.")
390- async def _create (
400+ @deprecated ("Use zarr.api.asynchronous.create_array instead." )
401+ @_deprecate_positional_args
402+ async def create (
391403 cls ,
392404 store : StoreLike ,
393405 * ,
@@ -418,9 +430,7 @@ async def _create(
418430 data : npt .ArrayLike | None = None ,
419431 config : ArrayConfig | ArrayConfigParams | None = None ,
420432 ) -> AsyncArray [ArrayV2Metadata ] | AsyncArray [ArrayV3Metadata ]:
421- """
422- Deprecated in favor of `zarr.api.asynchronous.create_array`.
423- Method to create a new asynchronous array instance.
433+ """Method to create a new asynchronous array instance.
424434
425435 Parameters
426436 ----------
@@ -499,6 +509,70 @@ async def _create(
499509 -------
500510 AsyncArray
501511 The created asynchronous array instance.
512+
513+ .. deprecated:: 3.0.0
514+ Deprecated in favor of :func:`zarr.api.asynchronous.create_array`.
515+ """
516+ return await cls ._create (
517+ store ,
518+ # v2 and v3
519+ shape = shape ,
520+ dtype = dtype ,
521+ zarr_format = zarr_format ,
522+ fill_value = fill_value ,
523+ attributes = attributes ,
524+ # v3 only
525+ chunk_shape = chunk_shape ,
526+ chunk_key_encoding = chunk_key_encoding ,
527+ codecs = codecs ,
528+ dimension_names = dimension_names ,
529+ # v2 only
530+ chunks = chunks ,
531+ dimension_separator = dimension_separator ,
532+ order = order ,
533+ filters = filters ,
534+ compressor = compressor ,
535+ # runtime
536+ overwrite = overwrite ,
537+ data = data ,
538+ config = config ,
539+ )
540+
541+ @classmethod
542+ async def _create (
543+ cls ,
544+ store : StoreLike ,
545+ * ,
546+ # v2 and v3
547+ shape : ShapeLike ,
548+ dtype : npt .DTypeLike ,
549+ zarr_format : ZarrFormat = 3 ,
550+ fill_value : Any | None = None ,
551+ attributes : dict [str , JSON ] | None = None ,
552+ # v3 only
553+ chunk_shape : ShapeLike | None = None ,
554+ chunk_key_encoding : (
555+ ChunkKeyEncoding
556+ | tuple [Literal ["default" ], Literal ["." , "/" ]]
557+ | tuple [Literal ["v2" ], Literal ["." , "/" ]]
558+ | None
559+ ) = None ,
560+ codecs : Iterable [Codec | dict [str , JSON ]] | None = None ,
561+ dimension_names : Iterable [str ] | None = None ,
562+ # v2 only
563+ chunks : ShapeLike | None = None ,
564+ dimension_separator : Literal ["." , "/" ] | None = None ,
565+ order : MemoryOrder | None = None ,
566+ filters : list [dict [str , JSON ]] | None = None ,
567+ compressor : dict [str , JSON ] | None = None ,
568+ # runtime
569+ overwrite : bool = False ,
570+ data : npt .ArrayLike | None = None ,
571+ config : ArrayConfig | ArrayConfigParams | None = None ,
572+ ) -> AsyncArray [ArrayV2Metadata ] | AsyncArray [ArrayV3Metadata ]:
573+ """Method to create a new asynchronous array instance.
574+ See :func:`AsyncArray.create` for more details.
575+ Deprecated in favor of :func:`zarr.api.asynchronous.create_array`.
502576 """
503577 store_path = await make_store_path (store )
504578
@@ -1529,9 +1603,9 @@ class Array:
15291603 _async_array : AsyncArray [ArrayV3Metadata ] | AsyncArray [ArrayV2Metadata ]
15301604
15311605 @classmethod
1532- # @deprecated("Use ` zarr.create_array` instead.")
1606+ @deprecated ("Use zarr.create_array instead." )
15331607 @_deprecate_positional_args
1534- def _create (
1608+ def create (
15351609 cls ,
15361610 store : StoreLike ,
15371611 * ,
@@ -1561,8 +1635,7 @@ def _create(
15611635 overwrite : bool = False ,
15621636 config : ArrayConfig | ArrayConfigParams | None = None ,
15631637 ) -> Array :
1564- """Deprecated in favor of `zarr.create_array`.
1565- Creates a new Array instance from an initialized store.
1638+ """Creates a new Array instance from an initialized store.
15661639
15671640 Parameters
15681641 ----------
@@ -1631,6 +1704,68 @@ def _create(
16311704 -------
16321705 Array
16331706 Array created from the store.
1707+
1708+ .. deprecated:: 3.0.0
1709+ Deprecated in favor of :func:`zarr.create_array`.
1710+ """
1711+ return cls ._create (
1712+ store ,
1713+ # v2 and v3
1714+ shape = shape ,
1715+ dtype = dtype ,
1716+ zarr_format = zarr_format ,
1717+ attributes = attributes ,
1718+ fill_value = fill_value ,
1719+ # v3 only
1720+ chunk_shape = chunk_shape ,
1721+ chunk_key_encoding = chunk_key_encoding ,
1722+ codecs = codecs ,
1723+ dimension_names = dimension_names ,
1724+ # v2 only
1725+ chunks = chunks ,
1726+ dimension_separator = dimension_separator ,
1727+ order = order ,
1728+ filters = filters ,
1729+ compressor = compressor ,
1730+ # runtime
1731+ overwrite = overwrite ,
1732+ config = config ,
1733+ )
1734+
1735+ @classmethod
1736+ def _create (
1737+ cls ,
1738+ store : StoreLike ,
1739+ * ,
1740+ # v2 and v3
1741+ shape : ChunkCoords ,
1742+ dtype : npt .DTypeLike ,
1743+ zarr_format : ZarrFormat = 3 ,
1744+ fill_value : Any | None = None ,
1745+ attributes : dict [str , JSON ] | None = None ,
1746+ # v3 only
1747+ chunk_shape : ChunkCoords | None = None ,
1748+ chunk_key_encoding : (
1749+ ChunkKeyEncoding
1750+ | tuple [Literal ["default" ], Literal ["." , "/" ]]
1751+ | tuple [Literal ["v2" ], Literal ["." , "/" ]]
1752+ | None
1753+ ) = None ,
1754+ codecs : Iterable [Codec | dict [str , JSON ]] | None = None ,
1755+ dimension_names : Iterable [str ] | None = None ,
1756+ # v2 only
1757+ chunks : ChunkCoords | None = None ,
1758+ dimension_separator : Literal ["." , "/" ] | None = None ,
1759+ order : MemoryOrder | None = None ,
1760+ filters : list [dict [str , JSON ]] | None = None ,
1761+ compressor : dict [str , JSON ] | None = None ,
1762+ # runtime
1763+ overwrite : bool = False ,
1764+ config : ArrayConfig | ArrayConfigParams | None = None ,
1765+ ) -> Array :
1766+ """Creates a new Array instance from an initialized store.
1767+ See :func:`Array.create` for more details.
1768+ Deprecated in favor of :func:`zarr.create_array`.
16341769 """
16351770 async_array = sync (
16361771 AsyncArray ._create (
0 commit comments