Skip to content
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Fixes

- `fractal_fsspec_store` accepts OME-Zarr 0.5 (zarr v3) stores. Its reachability probe only fetched the zarr v2 keys `.zgroup` and `.zarray`, so any v3 store, which has a `zarr.json` instead, raised `NgioValueError("Store ... can not be read")` even though the data was reachable. The probe now tries `zarr.json` first; the missing/invalid `fractal_token` errors apply to v3 stores too ([#289](https://github.com/BioVisionCenter/ngio/issues/289)).

## [v1.1.4]

### Features
Expand Down
3 changes: 2 additions & 1 deletion src/ngio/utils/_fractal_fsspec_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def fractal_fsspec_store(

store = fs.get_mapper(url)

possible_keys = [".zgroup", ".zarray"]
# zarr v3 (`zarr.json`) first, then the zarr v2 keys.
possible_keys = ["zarr.json", ".zgroup", ".zarray"]
for key in possible_keys:
value = _probe_key(store, url, key, fractal_token)
if value is not None:
Expand Down
26 changes: 24 additions & 2 deletions tests/stores/test_http_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
random_zarr_path,
)

from ngio import open_ome_zarr_container
from ngio.utils import NgioValueError
from ngio import create_empty_ome_zarr, open_ome_zarr_container
from ngio.utils import NgioValueError, fractal_fsspec_store

HTTP_STORE_SUPPORTED_BACKENDS = ["anndata", "json", "csv", "parquet"]

Expand Down Expand Up @@ -80,3 +80,25 @@ def test_http_store_derive_to_memory_store(http_static_server: dict) -> None:
other_store = {}
with pytest.raises(NgioValueError, match="not listable"):
derive_image(ome_zarr, other_store=other_store)


@pytest.mark.parametrize("ngff_version", ["0.4", "0.5"])
def test_fractal_fsspec_store(http_static_server: dict, ngff_version: str) -> None:
# 0.5 is zarr v3: the store has a `zarr.json` and no `.zgroup` (#289).
url, root = http_static_server["url"], http_static_server["root"]
zarr_path = random_zarr_path()
create_empty_ome_zarr(
root / zarr_path,
shape=(8, 8),
pixelsize=0.5,
levels=1,
ngff_version=ngff_version,
)
store = fractal_fsspec_store(f"{url}/{zarr_path}")
assert open_ome_zarr_container(store).get_image().shape == (8, 8)


def test_fractal_fsspec_store_not_a_zarr(http_static_server: dict) -> None:
url = http_static_server["url"]
with pytest.raises(NgioValueError, match="can not be read"):
fractal_fsspec_store(f"{url}/{random_zarr_path()}")
Loading