Skip to content

Commit e6306a8

Browse files
authored
Migrate to Icechunk v1.0, exclude broken Xarray compatibility (#673)
* Migrate to Icechunk v1.0 * Exclude broken xarray versions * Multiple chunk containers
1 parent 3842634 commit e6306a8

File tree

3 files changed

+41
-14
lines changed

3 files changed

+41
-14
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ classifiers = [
2121
requires-python = ">=3.11"
2222
dynamic = ["version"]
2323
dependencies = [
24-
"xarray>=2025.3.0",
24+
"xarray>=2025.3.0,!=2025.7.0,!=2025.7.1",
2525
"numpy>=2.0.0",
2626
"universal-pathlib",
2727
"numcodecs>=0.15.1",
@@ -75,7 +75,7 @@ all_parsers = [
7575

7676
# writers
7777
icechunk = [
78-
"icechunk>=0.2.4",
78+
"icechunk>=1.0.0",
7979
]
8080
kerchunk = ["fastparquet"]
8181

virtualizarr/tests/test_integration.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
)
2424
from virtualizarr.tests.utils import obstore_local
2525

26+
icechunk = pytest.importorskip("icechunk")
27+
2628
RoundtripFunction: TypeAlias = Callable[
2729
Concatenate[xr.Dataset | xr.DataTree, Path, ...], xr.Dataset | xr.DataTree
2830
]
@@ -132,11 +134,25 @@ def roundtrip_as_in_memory_icechunk(
132134
virtualize_kwargs: Mapping[str, Any] | None = None,
133135
**kwargs,
134136
) -> xr.Dataset | xr.DataTree:
135-
from icechunk import Repository, Storage
136-
137137
# create an in-memory icechunk store
138-
storage = Storage.new_in_memory()
139-
repo = Repository.create(storage=storage)
138+
storage = icechunk.Storage.new_in_memory()
139+
140+
config = icechunk.RepositoryConfig.default()
141+
142+
url_prefixes = ["file:///private/var/folders/70", "file:///tmp/"]
143+
144+
for url_prefix in url_prefixes:
145+
container = icechunk.VirtualChunkContainer(
146+
url_prefix=url_prefix,
147+
store=icechunk.local_filesystem_store(url_prefix),
148+
)
149+
config.set_virtual_chunk_container(container)
150+
151+
repo = icechunk.Repository.create(
152+
storage=storage,
153+
config=config,
154+
authorize_virtual_chunk_access={prefix: None for prefix in url_prefixes},
155+
)
140156
session = repo.writable_session("main")
141157

142158
# write those references to an icechunk store

virtualizarr/tests/test_writers/test_icechunk.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
from pathlib import Path
44
from typing import TYPE_CHECKING, Any, Callable, Optional
55

6-
import pytest
7-
8-
pytest.importorskip("icechunk")
9-
106
import numpy as np
117
import numpy.testing as npt
8+
import pytest
129
import xarray as xr
1310
import xarray.testing as xrt
1411
import zarr
@@ -19,6 +16,8 @@
1916
from virtualizarr.writers.icechunk import generate_chunk_key
2017
from virtualizarr.xarray import separate_coords
2118

19+
icechunk = pytest.importorskip("icechunk")
20+
2221
if TYPE_CHECKING:
2322
from icechunk import ( # type: ignore[import-not-found]
2423
IcechunkStore,
@@ -35,11 +34,23 @@ def icechunk_storage(tmp_path: Path) -> "Storage":
3534

3635

3736
@pytest.fixture(scope="function")
38-
def icechunk_repo(icechunk_storage: "Storage") -> "Repository":
39-
from icechunk import Repository
37+
def icechunk_repo(icechunk_storage: "Storage", tmp_path: Path) -> "Repository":
38+
config = icechunk.RepositoryConfig.default()
4039

41-
repo = Repository.create(storage=icechunk_storage)
42-
return repo
40+
url_prefixes = ["file:///private/var/folders/70", "file:///tmp/"]
41+
42+
for url_prefix in url_prefixes:
43+
container = icechunk.VirtualChunkContainer(
44+
url_prefix=url_prefix,
45+
store=icechunk.local_filesystem_store(url_prefix),
46+
)
47+
config.set_virtual_chunk_container(container)
48+
49+
return icechunk.Repository.create(
50+
storage=icechunk_storage,
51+
config=config,
52+
authorize_virtual_chunk_access={prefix: None for prefix in url_prefixes},
53+
)
4354

4455

4556
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)