Skip to content

Commit

Permalink
Fix import errors in icechunk writer
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Oct 22, 2024
1 parent 8cd5237 commit 542a953
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions virtualizarr/writers/icechunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ def dataset_to_icechunk(ds: Dataset, store: "IcechunkStore") -> None:
ds: xr.Dataset
store: IcechunkStore
"""
from icechunk import IcechunkStore # type: ignore[import-not-found]
from zarr import Group # type: ignore[import-untyped]
try:
from icechunk import IcechunkStore # type: ignore[import-not-found]
from zarr import Group # type: ignore[import-untyped]
except ImportError:
raise ImportError(
"The 'icechunk' and 'zarr' version 3 libraries are required to use this function"
)

if not isinstance(store, IcechunkStore):
raise TypeError(f"expected type IcechunkStore, but got type {type(store)}")
Expand Down

0 comments on commit 542a953

Please sign in to comment.