Skip to content

Use donfig for V3 configuration #1855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies = [
'crc32c',
'zstandard',
'typing_extensions',
'donfig'
]
dynamic = [
"version",
Expand Down
12 changes: 4 additions & 8 deletions src/zarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import zarr.codecs # noqa: F401
from zarr.array import Array, AsyncArray # noqa: F401
from zarr.array_v2 import ArrayV2
from zarr.config import RuntimeConfiguration # noqa: F401
from zarr.config import config # noqa: F401
from zarr.group import AsyncGroup, Group # noqa: F401
from zarr.metadata import runtime_configuration # noqa: F401
from zarr.store import ( # noqa: F401
StoreLike,
make_store_path,
Expand All @@ -21,22 +20,19 @@

async def open_auto_async(
store: StoreLike,
runtime_configuration_: RuntimeConfiguration = RuntimeConfiguration(),
) -> Union[AsyncArray, AsyncGroup]:
store_path = make_store_path(store)
try:
return await AsyncArray.open(store_path, runtime_configuration=runtime_configuration_)
return await AsyncArray.open(store_path)
except KeyError:
return await AsyncGroup.open(store_path, runtime_configuration=runtime_configuration_)
return await AsyncGroup.open(store_path)


def open_auto(
store: StoreLike,
runtime_configuration_: RuntimeConfiguration = RuntimeConfiguration(),
) -> Union[Array, ArrayV2, Group]:
object = _sync(
open_auto_async(store, runtime_configuration_),
runtime_configuration_.asyncio_loop,
open_auto_async(store),
)
if isinstance(object, AsyncArray):
return Array(object)
Expand Down
9 changes: 0 additions & 9 deletions src/zarr/abc/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from typing_extensions import Self
from zarr.common import BytesLike, SliceSelection
from zarr.metadata import ArrayMetadata
from zarr.config import RuntimeConfiguration


class Codec(Metadata):
Expand All @@ -40,7 +39,6 @@ async def decode(
self,
chunk_array: np.ndarray,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> np.ndarray:
pass

Expand All @@ -49,7 +47,6 @@ async def encode(
self,
chunk_array: np.ndarray,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> Optional[np.ndarray]:
pass

Expand All @@ -60,7 +57,6 @@ async def decode(
self,
chunk_array: BytesLike,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> np.ndarray:
pass

Expand All @@ -69,7 +65,6 @@ async def encode(
self,
chunk_array: np.ndarray,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> Optional[BytesLike]:
pass

Expand All @@ -81,7 +76,6 @@ async def decode_partial(
store_path: StorePath,
selection: SliceSelection,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> Optional[np.ndarray]:
pass

Expand All @@ -94,7 +88,6 @@ async def encode_partial(
chunk_array: np.ndarray,
selection: SliceSelection,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> None:
pass

Expand All @@ -105,7 +98,6 @@ async def decode(
self,
chunk_array: BytesLike,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> BytesLike:
pass

Expand All @@ -114,6 +106,5 @@ async def encode(
self,
chunk_array: BytesLike,
chunk_spec: ArraySpec,
runtime_configuration: RuntimeConfiguration,
) -> Optional[BytesLike]:
pass
Loading
Loading