4141ArrayNotFoundError ,
4242GroupNotFoundError ,
4343NodeTypeValidationError ,
44- ZarrDeprecationWarning ,
4544ZarrRuntimeWarning ,
4645ZarrUserWarning ,
4746)
@@ -166,22 +165,6 @@ def _like_args(a: ArrayLike) -> _LikeArgs:
166165return new
167166
168167
169- def _handle_zarr_version_or_format (
170- * ,zarr_version :ZarrFormat | None ,zarr_format :ZarrFormat | None
171- )-> ZarrFormat | None :
172- """Handle the deprecated zarr_version kwarg and return zarr_format"""
173- if zarr_format is not None and zarr_version is not None and zarr_format != zarr_version :
174- raise ValueError (
175- f"zarr_format{ zarr_format } does not match zarr_version{ zarr_version } , please only set one"
176- )
177- if zarr_version is not None :
178- warnings .warn (
179- "zarr_version is deprecated, use zarr_format" ,ZarrDeprecationWarning ,stacklevel = 2
180- )
181- return zarr_version
182- return zarr_format
183-
184-
185168async def consolidate_metadata (
186169store :StoreLike ,
187170path :str | None = None ,
@@ -284,7 +267,6 @@ async def load(
284267store :StoreLike ,
285268path :str | None = None ,
286269zarr_format :ZarrFormat | None = None ,
287- zarr_version :ZarrFormat | None = None ,
288270)-> NDArrayLikeOrScalar | dict [str ,NDArrayLikeOrScalar ]:
289271"""Load data from an array or group into memory.
290272
@@ -311,8 +293,6 @@ async def load(
311293 If loading data from a group of arrays, data will not be immediately loaded into
312294 memory. Rather, arrays will be loaded into memory as they are requested.
313295 """
314- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
315-
316296obj = await open (store = store ,path = path ,zarr_format = zarr_format )
317297if isinstance (obj ,AsyncArray ):
318298return await obj .getitem (slice (None ))
@@ -324,7 +304,6 @@ async def open(
324304* ,
325305store :StoreLike | None = None ,
326306mode :AccessModeLiteral | None = None ,
327- zarr_version :ZarrFormat | None = None ,# deprecated
328307zarr_format :ZarrFormat | None = None ,
329308path :str | None = None ,
330309storage_options :dict [str ,Any ]| None = None ,
@@ -358,7 +337,6 @@ async def open(
358337 z : array or group
359338 Return type depends on what exists in the given store.
360339 """
361- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
362340if mode is None :
363341if isinstance (store , (Store ,StorePath ))and store .read_only :
364342mode = "r"
@@ -409,7 +387,6 @@ async def open_consolidated(
409387async def save (
410388store :StoreLike ,
411389* args :NDArrayLike ,
412- zarr_version :ZarrFormat | None = None ,# deprecated
413390zarr_format :ZarrFormat | None = None ,
414391path :str | None = None ,
415392** kwargs :Any ,# TODO: type kwargs as valid args to save
@@ -429,7 +406,6 @@ async def save(
429406 **kwargs
430407 NumPy arrays with data to save.
431408 """
432- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
433409
434410if len (args )== 0 and len (kwargs )== 0 :
435411raise ValueError ("at least one array must be provided" )
@@ -443,7 +419,6 @@ async def save_array(
443419store :StoreLike ,
444420arr :NDArrayLike ,
445421* ,
446- zarr_version :ZarrFormat | None = None ,# deprecated
447422zarr_format :ZarrFormat | None = None ,
448423path :str | None = None ,
449424storage_options :dict [str ,Any ]| None = None ,
@@ -469,10 +444,7 @@ async def save_array(
469444 **kwargs
470445 Passed through to [`create`][zarr.api.asynchronous.create], e.g., compressor.
471446 """
472- zarr_format = (
473- _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
474- or _default_zarr_format ()
475- )
447+ zarr_format = zarr_format or _default_zarr_format ()
476448if not isinstance (arr ,NDArrayLike ):
477449raise TypeError ("arr argument must be numpy or other NDArrayLike array" )
478450
@@ -499,7 +471,6 @@ async def save_array(
499471async def save_group (
500472store :StoreLike ,
501473* args :NDArrayLike ,
502- zarr_version :ZarrFormat | None = None ,# deprecated
503474zarr_format :ZarrFormat | None = None ,
504475path :str | None = None ,
505476storage_options :dict [str ,Any ]| None = None ,
@@ -527,13 +498,7 @@ async def save_group(
527498
528499store_path = await make_store_path (store ,path = path ,mode = "w" ,storage_options = storage_options )
529500
530- zarr_format = (
531- _handle_zarr_version_or_format (
532- zarr_version = zarr_version ,
533- zarr_format = zarr_format ,
534- )
535- or _default_zarr_format ()
536- )
501+ zarr_format = zarr_format or _default_zarr_format ()
537502
538503for arg in args :
539504if not isinstance (arg ,NDArrayLike ):
@@ -624,7 +589,6 @@ async def group(
624589cache_attrs :bool | None = None ,# not used, default changed
625590synchronizer :Any | None = None ,# not used
626591path :str | None = None ,
627- zarr_version :ZarrFormat | None = None ,# deprecated
628592zarr_format :ZarrFormat | None = None ,
629593meta_array :Any | None = None ,# not used
630594attributes :dict [str ,JSON ]| None = None ,
@@ -675,7 +639,6 @@ async def group(
675639cache_attrs = cache_attrs ,
676640synchronizer = synchronizer ,
677641path = path ,
678- zarr_version = zarr_version ,
679642zarr_format = zarr_format ,
680643meta_array = meta_array ,
681644attributes = attributes ,
@@ -742,7 +705,6 @@ async def open_group(
742705path :str | None = None ,
743706chunk_store :StoreLike | None = None ,# not used
744707storage_options :dict [str ,Any ]| None = None ,
745- zarr_version :ZarrFormat | None = None ,# deprecated
746708zarr_format :ZarrFormat | None = None ,
747709meta_array :Any | None = None ,# not used
748710attributes :dict [str ,JSON ]| None = None ,
@@ -810,8 +772,6 @@ async def open_group(
810772 The new group.
811773 """
812774
813- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
814-
815775if cache_attrs is not None :
816776warnings .warn ("cache_attrs is not yet implemented" ,ZarrRuntimeWarning ,stacklevel = 2 )
817777if synchronizer is not None :
@@ -865,7 +825,6 @@ async def create(
865825object_codec :Codec | None = None ,# TODO: type has changed
866826dimension_separator :Literal ["." ,"/" ]| None = None ,
867827write_empty_chunks :bool | None = None ,
868- zarr_version :ZarrFormat | None = None ,# deprecated
869828zarr_format :ZarrFormat | None = None ,
870829meta_array :Any | None = None ,# TODO: need type
871830attributes :dict [str ,JSON ]| None = None ,
@@ -1005,10 +964,7 @@ async def create(
1005964 z : array
1006965 The array.
1007966 """
1008- zarr_format = (
1009- _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
1010- or _default_zarr_format ()
1011- )
967+ zarr_format = zarr_format or _default_zarr_format ()
1012968
1013969if synchronizer is not None :
1014970warnings .warn ("synchronizer is not yet implemented" ,ZarrRuntimeWarning ,stacklevel = 2 )
@@ -1212,7 +1168,6 @@ async def ones_like(
12121168async def open_array (
12131169* ,# note: this is a change from v2
12141170store :StoreLike | None = None ,
1215- zarr_version :ZarrFormat | None = None ,# deprecated
12161171zarr_format :ZarrFormat | None = None ,
12171172path :PathLike = "" ,
12181173storage_options :dict [str ,Any ]| None = None ,
@@ -1224,8 +1179,6 @@ async def open_array(
12241179 ----------
12251180 store : StoreLike
12261181 Store or path to directory in file system or name of zip file.
1227- zarr_version : {2, 3, None}, optional
1228- The zarr format to use when saving. Deprecated in favor of zarr_format.
12291182 zarr_format : {2, 3, None}, optional
12301183 The zarr format to use when saving.
12311184 path : str, optional
@@ -1245,8 +1198,6 @@ async def open_array(
12451198mode = kwargs .pop ("mode" ,None )
12461199store_path = await make_store_path (store ,path = path ,mode = mode ,storage_options = storage_options )
12471200
1248- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version ,zarr_format = zarr_format )
1249-
12501201if "write_empty_chunks" in kwargs :
12511202_warn_write_empty_chunks_kwarg ()
12521203