File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66from typing import Literal
77
88import zarr
9- from obstore .store import from_url as obstore_from_url
109from upath import UPath
1110from xarray import Dataset as xr_Dataset
1211from xarray import open_zarr as xr_open_zarr
1716from mdio .constants import ZarrFormat
1817from mdio .core .zarr_io import zarr_warnings_suppress_unstable_structs_v3
1918
19+ # optional runtime import
20+ try :
21+ from obstore .store import from_url as obstore_from_url
22+ except ImportError :
23+ obstore_from_url = None
24+
2025if TYPE_CHECKING :
2126 from collections .abc import Mapping
2227 from pathlib import Path
@@ -37,6 +42,10 @@ def _normalize_path(path: UPath | Path | str) -> UPath:
3742
3843def _get_store (upath : UPath , storage_backend : StorageBackendT ) -> Store :
3944 if storage_backend == "obstore" :
45+ if obstore_from_url is None :
46+ msg = "Optional dependency 'obstore' is not installed. Install it with `pip install multidimio[cloud]`."
47+ raise RuntimeError (msg )
48+
4049 uri = upath .as_posix ()
4150 storage_options : Mapping [str , Any ] = getattr (upath , "storage_options" , {})
4251 return ObjectStore (obstore_from_url (uri , ** storage_options ))
You can’t perform that action at this time.
0 commit comments