Zarr version
v3.0.0
Numcodecs version
v0.14.1
Python Version
3.11.11
Operating System
Mac
Installation
using pip into conda environment
Description
With Zarr v2, I was able to pass a store of type fsspec.mapping.FSMap. However, with Zarr v3, I get the following error:
TypeError: Unsupported type for store_like: 'FSMap'
Is this a bug, a breaking change, or was passing mappers like FSMap not officially supported even in Zarr v2?
The snippet below only works with Zarr v2.
Steps to reproduce
importtempfileimportfsspecimportzarrfs=fsspec.filesystem("file")
withtempfile.TemporaryDirectory() astmpdir:
mapper=fs.get_mapper(tmpdir)
z=zarr.open(store=mapper, shape=(100, 100), chunks=(10, 10), dtype="f4")Additional output
---------------------------------------------------------------------------TypeErrorTraceback (mostrecentcalllast)
CellIn[7], line97withtempfile.TemporaryDirectory() astmpdir:
8mapper=fs.get_mapper(tmpdir)
---->9z=zarr.open(store=mapper, shape=(100, 100), chunks=(10, 10), dtype="f4")
File~/miniforge3/envs/zarr/lib/python3.11/site-packages/zarr/_compat.py:43, in_deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
41extra_args=len(args) -len(all_args)
42ifextra_args<=0:
--->43returnf(*args, **kwargs)
45# extra_args > 046args_msg= [
47f"{name}={arg}"48forname, arginzip(kwonly_args[:extra_args], args[-extra_args:], strict=False)
49 ]
File~/miniforge3/envs/zarr/lib/python3.11/site-packages/zarr/api/synchronous.py:190, inopen(store, mode, zarr_version, zarr_format, path, storage_options, **kwargs)
152 @_deprecate_positional_args153defopen(
154store: StoreLike|None=None,
(...)
161**kwargs: Any, # TODO: type kwargs as valid args to async_api.open162 ) ->Array|Group:
163"""Open a group or array using file-mode-like semantics. 164 165 Parameters (...) 188 Return type depends on what exists in the given store. 189 """-->190obj=sync(
191async_api.open(
192store=store,
193mode=mode,
194zarr_version=zarr_version,
195zarr_format=zarr_format,
196path=path,
197storage_options=storage_options,
198**kwargs,
199 )
200 )
201ifisinstance(obj, AsyncArray):
202returnArray(obj)
File~/miniforge3/envs/zarr/lib/python3.11/site-packages/zarr/core/sync.py:142, insync(coro, loop, timeout)
139return_result=next(iter(finished)).result()
141ifisinstance(return_result, BaseException):
-->142raisereturn_result143else:
144returnreturn_resultFile~/miniforge3/envs/zarr/lib/python3.11/site-packages/zarr/core/sync.py:98, in_runner(coro)
93""" 94 Await a coroutine and return the result of running it. If awaiting the coroutine raises an 95 exception, the exception will be returned. 96 """97try:
--->98returnawaitcoro99exceptExceptionasex:
100returnexFile~/miniforge3/envs/zarr/lib/python3.11/site-packages/zarr/api/asynchronous.py:309, inopen(store, mode, zarr_version, zarr_format, path, storage_options, **kwargs)
280"""Convenience function to open a group or array using file-mode-like semantics. 281 282 Parameters (...) 305 Return type depends on what exists in the given store. 306 """307zarr_format=_handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
-->309store_path=awaitmake_store_path(store, mode=mode, path=path, storage_options=storage_options)
311# TODO: the mode check below seems wrong!312if"shape"notinkwargsandmodein {"a", "r", "r+", "w"}:
File~/miniforge3/envs/zarr/lib/python3.11/site-packages/zarr/storage/_common.py:316, inmake_store_path(store_like, path, mode, storage_options)
314else:
315msg=f"Unsupported type for store_like: '{type(store_like).__name__}'"# type: ignore[unreachable]-->316raiseTypeError(msg)
318result=awaitStorePath.open(store, path=path_normalized, mode=mode)
320ifstorage_optionsandnotused_storage_options:
TypeError: Unsupportedtypeforstore_like: 'FSMap'
Zarr version
v3.0.0
Numcodecs version
v0.14.1
Python Version
3.11.11
Operating System
Mac
Installation
using pip into conda environment
Description
With Zarr v2, I was able to pass a store of type
fsspec.mapping.FSMap. However, with Zarr v3, I get the following error:Is this a bug, a breaking change, or was passing mappers like FSMap not officially supported even in Zarr v2?
The snippet below only works with Zarr v2.
Steps to reproduce
Additional output