Skip to content
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

fix: compatibility with zarr-python 3.0.3 #86

Merged
merged 2 commits into from
Feb 17, 2025
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
'donfig',
'pytest',
'universal_pathlib>=0.2.0',
"zarr",
"zarr>=3.0.3",
]

[project.optional-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions python/zarrs/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def encode(
async def read(
self,
batch_info: Iterable[
tuple[ByteGetter, ArraySpec, SelectorTuple, SelectorTuple]
tuple[ByteGetter, ArraySpec, SelectorTuple, SelectorTuple, bool]
],
out: NDBuffer, # type: ignore
drop_axes: tuple[int, ...] = (), # FIXME: unused
Expand Down Expand Up @@ -191,7 +191,7 @@ async def read(
async def write(
self,
batch_info: Iterable[
tuple[ByteSetter, ArraySpec, SelectorTuple, SelectorTuple]
tuple[ByteSetter, ArraySpec, SelectorTuple, SelectorTuple, bool]
],
value: NDBuffer, # type: ignore
drop_axes: tuple[int, ...] = (),
Expand Down Expand Up @@ -229,13 +229,13 @@ async def write(
def _raise_error_on_unsupported_batch_dtype(
self,
batch_info: Iterable[
tuple[ByteSetter, ArraySpec, SelectorTuple, SelectorTuple]
tuple[ByteSetter, ArraySpec, SelectorTuple, SelectorTuple, bool]
],
):
# https://github.com/LDeakin/zarrs/blob/0532fe983b7b42b59dbf84e50a2fe5e6f7bad4ce/zarrs_metadata/src/v2_to_v3.rs#L289-L293 for VSUMm
# Further, our pipeline does not support variable-length objects due to limitations on decode_into, so object is also out
if any(
info.dtype.kind in {"V", "S", "U", "M", "m", "O"}
for (_, info, _, _) in batch_info
for (_, info, _, _, _) in batch_info
):
raise UnsupportedDataTypeError()
10 changes: 8 additions & 2 deletions python/zarrs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,20 @@ def get_implicit_fill_value(dtype: np.dtype, fill_value: Any) -> Any:

def make_chunk_info_for_rust_with_indices(
batch_info: Iterable[
tuple[ByteGetter | ByteSetter, ArraySpec, SelectorTuple, SelectorTuple]
tuple[ByteGetter | ByteSetter, ArraySpec, SelectorTuple, SelectorTuple, bool]
],
drop_axes: tuple[int, ...],
shape: tuple[int, ...],
) -> list[WithSubset]:
shape = shape if shape else (1,) # constant array
chunk_info_with_indices: list[WithSubset] = []
for byte_getter, chunk_spec, chunk_selection, out_selection in batch_info:
for (
byte_getter,
chunk_spec,
chunk_selection,
out_selection,
_,
) in batch_info:
if chunk_spec.fill_value is None:
chunk_spec = ArraySpec(
chunk_spec.shape,
Expand Down