4141ArrayNotFoundError ,
4242GroupNotFoundError ,
4343NodeTypeValidationError ,
44- ZarrDeprecationWarning ,
4544ZarrRuntimeWarning ,
4645ZarrUserWarning ,
4746)
@@ -155,22 +154,6 @@ def _like_args(a: ArrayLike, kwargs: dict[str, Any]) -> dict[str, Any]:
155154return new
156155
157156
158- def _handle_zarr_version_or_format (
159- * ,zarr_version :ZarrFormat | None ,zarr_format :ZarrFormat | None
160- )-> ZarrFormat | None :
161- """Handle the deprecated zarr_version kwarg and return zarr_format"""
162- if zarr_format is not None and zarr_version is not None and zarr_format != zarr_version :
163- raise ValueError (
164- f"zarr_format{ zarr_format } does not match zarr_version{ zarr_version } , please only set one"
165- )
166- if zarr_version is not None :
167- warnings .warn (
168- "zarr_version is deprecated, use zarr_format" ,ZarrDeprecationWarning ,stacklevel = 2
169- )
170- return zarr_version
171- return zarr_format
172-
173-
174157async def consolidate_metadata (
175158store :StoreLike ,
176159path :str | None = None ,
@@ -264,7 +247,6 @@ async def load(
264247store :StoreLike ,
265248path :str | None = None ,
266249zarr_format :ZarrFormat | None = None ,
267- zarr_version :ZarrFormat | None = None ,
268250)-> NDArrayLikeOrScalar | dict [str ,NDArrayLikeOrScalar ]:
269251"""Load data from an array or group into memory.
270252
@@ -291,8 +273,6 @@ async def load(
291273 If loading data from a group of arrays, data will not be immediately loaded into
292274 memory. Rather, arrays will be loaded into memory as they are requested.
293275 """
294- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
295-
296276obj = await open (store = store ,path = path ,zarr_format = zarr_format )
297277if isinstance (obj ,AsyncArray ):
298278return await obj .getitem (slice (None ))
@@ -304,7 +284,6 @@ async def open(
304284* ,
305285store :StoreLike | None = None ,
306286mode :AccessModeLiteral | None = None ,
307- zarr_version :ZarrFormat | None = None ,# deprecated
308287zarr_format :ZarrFormat | None = None ,
309288path :str | None = None ,
310289storage_options :dict [str ,Any ]| None = None ,
@@ -338,7 +317,6 @@ async def open(
338317 z : array or group
339318 Return type depends on what exists in the given store.
340319 """
341- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
342320if mode is None :
343321if isinstance (store , (Store ,StorePath ))and store .read_only :
344322mode = "r"
@@ -389,7 +367,6 @@ async def open_consolidated(
389367async def save (
390368store :StoreLike ,
391369* args :NDArrayLike ,
392- zarr_version :ZarrFormat | None = None ,# deprecated
393370zarr_format :ZarrFormat | None = None ,
394371path :str | None = None ,
395372** kwargs :Any ,# TODO: type kwargs as valid args to save
@@ -409,7 +386,6 @@ async def save(
409386 **kwargs
410387 NumPy arrays with data to save.
411388 """
412- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
413389
414390if len (args )== 0 and len (kwargs )== 0 :
415391raise ValueError ("at least one array must be provided" )
@@ -423,7 +399,6 @@ async def save_array(
423399store :StoreLike ,
424400arr :NDArrayLike ,
425401* ,
426- zarr_version :ZarrFormat | None = None ,# deprecated
427402zarr_format :ZarrFormat | None = None ,
428403path :str | None = None ,
429404storage_options :dict [str ,Any ]| None = None ,
@@ -448,10 +423,7 @@ async def save_array(
448423 **kwargs
449424 Passed through to :func:`create`, e.g., compressor.
450425 """
451- zarr_format = (
452- _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
453- or _default_zarr_format ()
454- )
426+ zarr_format = zarr_format or _default_zarr_format ()
455427if not isinstance (arr ,NDArrayLike ):
456428raise TypeError ("arr argument must be numpy or other NDArrayLike array" )
457429
@@ -478,7 +450,6 @@ async def save_array(
478450async def save_group (
479451store :StoreLike ,
480452* args :NDArrayLike ,
481- zarr_version :ZarrFormat | None = None ,# deprecated
482453zarr_format :ZarrFormat | None = None ,
483454path :str | None = None ,
484455storage_options :dict [str ,Any ]| None = None ,
@@ -506,13 +477,7 @@ async def save_group(
506477
507478store_path = await make_store_path (store ,path = path ,mode = "w" ,storage_options = storage_options )
508479
509- zarr_format = (
510- _handle_zarr_version_or_format (
511- zarr_version = zarr_version ,
512- zarr_format = zarr_format ,
513- )
514- or _default_zarr_format ()
515- )
480+ zarr_format = zarr_format or _default_zarr_format ()
516481
517482for arg in args :
518483if not isinstance (arg ,NDArrayLike ):
@@ -603,7 +568,6 @@ async def group(
603568cache_attrs :bool | None = None ,# not used, default changed
604569synchronizer :Any | None = None ,# not used
605570path :str | None = None ,
606- zarr_version :ZarrFormat | None = None ,# deprecated
607571zarr_format :ZarrFormat | None = None ,
608572meta_array :Any | None = None ,# not used
609573attributes :dict [str ,JSON ]| None = None ,
@@ -644,8 +608,6 @@ async def group(
644608 The new group.
645609 """
646610
647- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
648-
649611mode :AccessModeLiteral
650612if overwrite :
651613mode = "w"
@@ -736,7 +698,6 @@ async def open_group(
736698path :str | None = None ,
737699chunk_store :StoreLike | None = None ,# not used
738700storage_options :dict [str ,Any ]| None = None ,
739- zarr_version :ZarrFormat | None = None ,# deprecated
740701zarr_format :ZarrFormat | None = None ,
741702meta_array :Any | None = None ,# not used
742703attributes :dict [str ,JSON ]| None = None ,
@@ -804,8 +765,6 @@ async def open_group(
804765 The new group.
805766 """
806767
807- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
808-
809768if cache_attrs is not None :
810769warnings .warn ("cache_attrs is not yet implemented" ,ZarrRuntimeWarning ,stacklevel = 2 )
811770if synchronizer is not None :
@@ -859,7 +818,6 @@ async def create(
859818object_codec :Codec | None = None ,# TODO: type has changed
860819dimension_separator :Literal ["." ,"/" ]| None = None ,
861820write_empty_chunks :bool | None = None ,
862- zarr_version :ZarrFormat | None = None ,# deprecated
863821zarr_format :ZarrFormat | None = None ,
864822meta_array :Any | None = None ,# TODO: need type
865823attributes :dict [str ,JSON ]| None = None ,
@@ -986,10 +944,7 @@ async def create(
986944 z : array
987945 The array.
988946 """
989- zarr_format = (
990- _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
991- or _default_zarr_format ()
992- )
947+ zarr_format = zarr_format or _default_zarr_format ()
993948
994949if synchronizer is not None :
995950warnings .warn ("synchronizer is not yet implemented" ,ZarrRuntimeWarning ,stacklevel = 2 )
@@ -1192,7 +1147,6 @@ async def ones_like(
11921147async def open_array (
11931148* ,# note: this is a change from v2
11941149store :StoreLike | None = None ,
1195- zarr_version :ZarrFormat | None = None ,# deprecated
11961150zarr_format :ZarrFormat | None = None ,
11971151path :PathLike = "" ,
11981152storage_options :dict [str ,Any ]| None = None ,
@@ -1204,8 +1158,6 @@ async def open_array(
12041158 ----------
12051159 store : Store or str
12061160 Store or path to directory in file system or name of zip file.
1207- zarr_version : {2, 3, None}, optional
1208- The zarr format to use when saving. Deprecated in favor of zarr_format.
12091161 zarr_format : {2, 3, None}, optional
12101162 The zarr format to use when saving.
12111163 path : str, optional
@@ -1225,8 +1177,6 @@ async def open_array(
12251177mode = kwargs .pop ("mode" ,None )
12261178store_path = await make_store_path (store ,path = path ,mode = mode ,storage_options = storage_options )
12271179
1228- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
1229-
12301180if "write_empty_chunks" in kwargs :
12311181_warn_write_empty_chunks_kwarg ()
12321182