Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e492be2
feat: functional .children method for groups
d-v-b Mar 26, 2024
b7f66c7
changes necessary for correctly generating list of children
d-v-b Mar 27, 2024
c7b333a
add stand-alone test for group.children
d-v-b Mar 27, 2024
a64b342
give type hints a glow-up
d-v-b Mar 27, 2024
3d11fc0
test: use separate assert statements to avoid platform-dependent orde…
d-v-b Mar 27, 2024
cf34afc
test: put fixtures in conftest, add MemoryStore fixture
d-v-b Mar 27, 2024
16cb226
docs: release notes
d-v-b Mar 27, 2024
b28eaee
test: remove prematurely-added mock s3 fixture
d-v-b Mar 30, 2024
0215b97
chore: move v3 tests into v3 folder
d-v-b Apr 4, 2024
e33ca6e
chore: type hints
d-v-b Apr 4, 2024
f237172
test: add schema for group method tests
d-v-b Apr 4, 2024
4605446
chore: add type for zarr_formats
d-v-b Apr 4, 2024
6e5ded9
chore: remove localstore for now
d-v-b Apr 4, 2024
f81b6f3
test: add __init__.py to support imports from top-level conftest.py, …
d-v-b Apr 4, 2024
c768ca8
fix: return valid JSON from GroupMetadata.to_bytes for v2 metadata
d-v-b Apr 4, 2024
c405506
fix: don't use a type as a value
d-v-b Apr 4, 2024
5b96554
test: add getitem test
d-v-b Apr 4, 2024
d77d55f
fix: replace reference to nonexistent method in with , which does e…
d-v-b Apr 5, 2024
05f89c6
test: declare v3ness via directory structure, not test file name
d-v-b Apr 5, 2024
b2f9bee
add a docstring to _get, and pass auto_mkdir to _put
d-v-b Apr 5, 2024
88f4c46
fix: add docstring to LocalStore.get_partial_values; adjust body of L…
d-v-b Apr 5, 2024
624ff77
test: add tests for localstore init, set, get, get_partial
d-v-b Apr 5, 2024
7dff5e5
feature(store): make list_* methods async generators
jhamman Apr 9, 2024
b762fa4
fix: Rename children to members; AsyncGroup.members yields tuples of …
d-v-b Apr 11, 2024
5574226
fix: make Group.members return a tuple of str, Array | Group pairs
d-v-b Apr 11, 2024
bcd5c7d
Merge branch 'v3' of github.com:zarr-developers/zarr-python into grou…
d-v-b Apr 11, 2024
d634cbf
fix: revert changes to synchronization code; this is churn that we ne…
d-v-b Apr 11, 2024
9b9d146
Merge branch 'v3' into group_children_fix
d-v-b Apr 12, 2024
d264f71
chore: move v3 tests into v3 folder
d-v-b Apr 4, 2024
0741bed
chore: type hints
d-v-b Apr 12, 2024
eb8a535
test: add schema for group method tests
d-v-b Apr 4, 2024
ee2e233
chore: add type for zarr_formats
d-v-b Apr 4, 2024
01eec6f
chore: remove localstore for now
d-v-b Apr 4, 2024
acae77a
test: add __init__.py to support imports from top-level conftest.py, …
d-v-b Apr 4, 2024
ebe1548
fix: return valid JSON from GroupMetadata.to_bytes for v2 metadata
d-v-b Apr 4, 2024
3dce5e3
fix: don't use a type as a value
d-v-b Apr 4, 2024
7f82fdf
test: add getitem test
d-v-b Apr 4, 2024
1655ff8
fix: replace reference to nonexistent method in with , which does e…
d-v-b Apr 5, 2024
e8514b1
test: declare v3ness via directory structure, not test file name
d-v-b Apr 5, 2024
dacacc8
add a docstring to _get, and pass auto_mkdir to _put
d-v-b Apr 5, 2024
5d2a532
fix: add docstring to LocalStore.get_partial_values; adjust body of L…
d-v-b Apr 5, 2024
06d8b04
test: add tests for localstore init, set, get, get_partial
d-v-b Apr 5, 2024
d8749de
fix: remove pre-emptive fetching from group.open
d-v-b Apr 16, 2024
a2fe4e0
Merge branch 'v3_group_tests' of github.com:d-v-b/zarr-python into v3…
d-v-b Apr 16, 2024
eed03c8
fix: use removeprefix (removes a substring) instead of strip (removes…
d-v-b Apr 16, 2024
75f75b1
xfail v2 tests that are sure to fail; add delitem tests; partition xf…
d-v-b Apr 16, 2024
8a14e3b
fix: handle byte_range[0] being None
d-v-b Apr 16, 2024
459bb42
fix: adjust test for localstore.get to check that get on nonexistent …
d-v-b Apr 16, 2024
8ef3fec
fix: add zarr_format parameter to array creation routines (which rais…
d-v-b Apr 17, 2024
b5a7698
test: add group init test
d-v-b Apr 17, 2024
9b2003c
Merge branch 'v3_group_tests' of github.com:d-v-b/zarr-python into fe…
jhamman Apr 19, 2024
ccb2dfe
Update src/zarr/v3/store/memory.py
jhamman Apr 19, 2024
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
6 changes: 6 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Release notes
Unreleased (v3)
---------------

Enhancements
~~~~~~~~~~~~

* Implement listing of the sub-arrays and sub-groups for a V3 ``Group``.
By :user:`Davis Bennett <d-v-b>` :issue:`1726`.

Maintenance
~~~~~~~~~~~

Expand Down
13 changes: 7 additions & 6 deletions src/zarr/v3/abc/store.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from abc import abstractmethod, ABC
from collections.abc import AsyncGenerator

from typing import List, Tuple, Optional

Expand Down Expand Up @@ -106,17 +107,17 @@ def supports_listing(self) -> bool:
...

@abstractmethod
async def list(self) -> List[str]:
async def list(self) -> AsyncGenerator[str, None]:
"""Retrieve all keys in the store.

Returns
-------
list[str]
AsyncGenerator[str, None]
"""
...

@abstractmethod
async def list_prefix(self, prefix: str) -> List[str]:
async def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]:
"""Retrieve all keys in the store with a given prefix.

Parameters
Expand All @@ -125,12 +126,12 @@ async def list_prefix(self, prefix: str) -> List[str]:

Returns
-------
list[str]
AsyncGenerator[str, None]
"""
...

@abstractmethod
async def list_dir(self, prefix: str) -> List[str]:
async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
"""
Retrieve all keys and prefixes with a given prefix and which do not contain the character
“/” after the given prefix.
Expand All @@ -141,6 +142,6 @@ async def list_dir(self, prefix: str) -> List[str]:

Returns
-------
list[str]
AsyncGenerator[str, None]
"""
...
50 changes: 27 additions & 23 deletions src/zarr/v3/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
ChunkCoords,
Selection,
SliceSelection,
ZarrFormat,
concurrent_map,
)
from zarr.v3.config import RuntimeConfiguration
Expand Down Expand Up @@ -88,6 +89,7 @@ async def create(
attributes: Optional[Dict[str, Any]] = None,
runtime_configuration: RuntimeConfiguration = RuntimeConfiguration(),
exists_ok: bool = False,
zarr_format: ZarrFormat = 3,
) -> AsyncArray:
store_path = make_store_path(store)
if not exists_ok:
Expand All @@ -100,31 +102,33 @@ async def create(
fill_value = False
else:
fill_value = 0
if zarr_format == 3:
metadata = ArrayMetadata(
shape=shape,
data_type=dtype,
chunk_grid=RegularChunkGrid(chunk_shape=chunk_shape),
chunk_key_encoding=(
V2ChunkKeyEncoding(separator=chunk_key_encoding[1])
if chunk_key_encoding[0] == "v2"
else DefaultChunkKeyEncoding(separator=chunk_key_encoding[1])
),
fill_value=fill_value,
codecs=codecs,
dimension_names=tuple(dimension_names) if dimension_names else None,
attributes=attributes or {},
)
runtime_configuration = runtime_configuration or RuntimeConfiguration()

metadata = ArrayMetadata(
shape=shape,
data_type=dtype,
chunk_grid=RegularChunkGrid(chunk_shape=chunk_shape),
chunk_key_encoding=(
V2ChunkKeyEncoding(separator=chunk_key_encoding[1])
if chunk_key_encoding[0] == "v2"
else DefaultChunkKeyEncoding(separator=chunk_key_encoding[1])
),
fill_value=fill_value,
codecs=codecs,
dimension_names=tuple(dimension_names) if dimension_names else None,
attributes=attributes or {},
)
runtime_configuration = runtime_configuration or RuntimeConfiguration()

array = cls(
metadata=metadata,
store_path=store_path,
runtime_configuration=runtime_configuration,
)
array = cls(
metadata=metadata,
store_path=store_path,
runtime_configuration=runtime_configuration,
)

await array._save_metadata()
return array
await array._save_metadata()
return array
else:
raise NotImplementedError("Zarr version 2 arrays cannot be created yet.")

@classmethod
def from_dict(
Expand Down
3 changes: 2 additions & 1 deletion src/zarr/v3/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Union, Tuple, Iterable, Dict, List, TypeVar, overload
from typing import TYPE_CHECKING, Literal, Union, Tuple, Iterable, Dict, List, TypeVar, overload
import asyncio
import contextvars
from dataclasses import dataclass
Expand All @@ -21,6 +21,7 @@
ChunkCoordsLike = Iterable[int]
SliceSelection = Tuple[slice, ...]
Selection = Union[slice, SliceSelection]
ZarrFormat = Literal[2, 3]
JSON = Union[str, None, int, float, Enum, Dict[str, "JSON"], List["JSON"], Tuple["JSON", ...]]


Expand Down
Loading