Skip to content

Commit 9b4b2ce

Browse files
committed
BUG: CLI zarr.storage imports for zarr-python 3.0.0b2
1 parent 2a9412e commit 9b4b2ce

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ngff_zarr/cli.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
)
2626
from rich.spinner import Spinner
2727
from rich_argparse import RichHelpFormatter
28-
from zarr.storage import DirectoryStore
28+
import zarr.storage
29+
30+
if hasattr(zarr.storage, "DirectoryStore"):
31+
LocalStore = zarr.storage.DirectoryStore
32+
else:
33+
LocalStore = zarr.storage.LocalStore
2934

3035
from .cli_input_to_ngff_image import cli_input_to_ngff_image
3136
from .config import config
@@ -236,7 +241,7 @@ def main():
236241
cache_dir = Path(args.cache_dir).resolve()
237242
if not cache_dir.exists():
238243
Path.makedirs(cache_dir, parents=True)
239-
config.cache_store = zarr.storage.DirectoryStore(cache_dir, **zarr_kwargs)
244+
config.cache_store = LocalStore(cache_dir, **zarr_kwargs)
240245

241246
console = Console()
242247
progress = RichProgress(
@@ -303,7 +308,7 @@ def shutdown_client(sig_id, frame): # noqa: ARG001
303308
)
304309
output_store = None
305310
if args.output and output_backend is ConversionBackend.NGFF_ZARR:
306-
output_store = DirectoryStore(args.output, **zarr_kwargs)
311+
output_store = LocalStore(args.output, **zarr_kwargs)
307312

308313
subtitle = "[red]generation"
309314
if not args.output:
@@ -332,7 +337,7 @@ def shutdown_client(sig_id, frame): # noqa: ARG001
332337
return
333338

334339
if input_backend is ConversionBackend.NGFF_ZARR:
335-
store = zarr.storage.DirectoryStore(args.input[0])
340+
store = LocalStore(args.input[0])
336341
multiscales = from_ngff_zarr(store)
337342
_multiscales_to_ngff_zarr(
338343
live, args, output_store, rich_dask_progress, multiscales

0 commit comments

Comments
 (0)