Skip to content

Commit 5bb3375

Browse files
maxrjonesjhamman
andauthored
Use donfig for V3 configuration (#1855)
* Use donfig for sync configuration * Consolidate concurrency config * Remove unused parameter * finish removing runtime config -- a few todos remain * fix order constructor * add basic tests for config state * add order property to Array * update comment in sharding codec --------- Co-authored-by: Joseph Hamman <joe@earthmover.io>
1 parent 666a8b9 commit 5bb3375

23 files changed

+158
-288
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies = [
1919
'crc32c',
2020
'zstandard',
2121
'typing_extensions',
22+
'donfig'
2223
]
2324
dynamic = [
2425
"version",

src/zarr/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
import zarr.codecs # noqa: F401
66
from zarr.array import Array, AsyncArray # noqa: F401
77
from zarr.array_v2 import ArrayV2
8-
from zarr.config import RuntimeConfiguration # noqa: F401
8+
from zarr.config import config # noqa: F401
99
from zarr.group import AsyncGroup, Group # noqa: F401
10-
from zarr.metadata import runtime_configuration # noqa: F401
1110
from zarr.store import ( # noqa: F401
1211
StoreLike,
1312
make_store_path,
@@ -21,22 +20,19 @@
2120

2221
async def open_auto_async(
2322
store: StoreLike,
24-
runtime_configuration_: RuntimeConfiguration = RuntimeConfiguration(),
2523
) -> Union[AsyncArray, AsyncGroup]:
2624
store_path = make_store_path(store)
2725
try:
28-
return await AsyncArray.open(store_path, runtime_configuration=runtime_configuration_)
26+
return await AsyncArray.open(store_path)
2927
except KeyError:
30-
return await AsyncGroup.open(store_path, runtime_configuration=runtime_configuration_)
28+
return await AsyncGroup.open(store_path)
3129

3230

3331
def open_auto(
3432
store: StoreLike,
35-
runtime_configuration_: RuntimeConfiguration = RuntimeConfiguration(),
3633
) -> Union[Array, ArrayV2, Group]:
3734
object = _sync(
38-
open_auto_async(store, runtime_configuration_),
39-
runtime_configuration_.asyncio_loop,
35+
open_auto_async(store),
4036
)
4137
if isinstance(object, AsyncArray):
4238
return Array(object)

src/zarr/abc/codec.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from typing_extensions import Self
1515
from zarr.common import BytesLike, SliceSelection
1616
from zarr.metadata import ArrayMetadata
17-
from zarr.config import RuntimeConfiguration
1817

1918

2019
class Codec(Metadata):
@@ -40,7 +39,6 @@ async def decode(
4039
self,
4140
chunk_array: np.ndarray,
4241
chunk_spec: ArraySpec,
43-
runtime_configuration: RuntimeConfiguration,
4442
) -> np.ndarray:
4543
pass
4644

@@ -49,7 +47,6 @@ async def encode(
4947
self,
5048
chunk_array: np.ndarray,
5149
chunk_spec: ArraySpec,
52-
runtime_configuration: RuntimeConfiguration,
5350
) -> Optional[np.ndarray]:
5451
pass
5552

@@ -60,7 +57,6 @@ async def decode(
6057
self,
6158
chunk_array: BytesLike,
6259
chunk_spec: ArraySpec,
63-
runtime_configuration: RuntimeConfiguration,
6460
) -> np.ndarray:
6561
pass
6662

@@ -69,7 +65,6 @@ async def encode(
6965
self,
7066
chunk_array: np.ndarray,
7167
chunk_spec: ArraySpec,
72-
runtime_configuration: RuntimeConfiguration,
7368
) -> Optional[BytesLike]:
7469
pass
7570

@@ -81,7 +76,6 @@ async def decode_partial(
8176
store_path: StorePath,
8277
selection: SliceSelection,
8378
chunk_spec: ArraySpec,
84-
runtime_configuration: RuntimeConfiguration,
8579
) -> Optional[np.ndarray]:
8680
pass
8781

@@ -94,7 +88,6 @@ async def encode_partial(
9488
chunk_array: np.ndarray,
9589
selection: SliceSelection,
9690
chunk_spec: ArraySpec,
97-
runtime_configuration: RuntimeConfiguration,
9891
) -> None:
9992
pass
10093

@@ -105,7 +98,6 @@ async def decode(
10598
self,
10699
chunk_array: BytesLike,
107100
chunk_spec: ArraySpec,
108-
runtime_configuration: RuntimeConfiguration,
109101
) -> BytesLike:
110102
pass
111103

@@ -114,6 +106,5 @@ async def encode(
114106
self,
115107
chunk_array: BytesLike,
116108
chunk_spec: ArraySpec,
117-
runtime_configuration: RuntimeConfiguration,
118109
) -> Optional[BytesLike]:
119110
pass

0 commit comments

Comments
 (0)