Skip to content

Commit 57f9b98

Browse files
committed
Error on zarr v3
1 parent 945574e commit 57f9b98

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.github/workflows/tests.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,34 @@ jobs:
1111
name: Lint
1212
uses: tskit-dev/.github/.github/workflows/lint.yml@v2
1313

14+
zarr-v3-compatibility:
15+
name: Test zarr v3 error
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/[email protected]
20+
with:
21+
submodules: true
22+
23+
- name: Install uv and set the python version
24+
uses: astral-sh/setup-uv@v6
25+
with:
26+
python-version: "3.12"
27+
version: "0.8.15"
28+
29+
- name: Setup venv
30+
run: |
31+
uv venv
32+
33+
- name: Install zarr v3 and tsinfer
34+
run: |
35+
uv pip install -e .
36+
uv pip install --upgrade zarr
37+
38+
- name: Test zarr v3 error
39+
run: |
40+
uv run --no-sync python -c "import tsinfer" 2>&1 | grep -q "zarr version.*is not supported"
41+
1442
test:
1543
name: Python
1644
runs-on: ${{ matrix.os }}

tsinfer/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@
3434
if sys.version_info[0] < 3:
3535
raise Exception("Python 3 only")
3636

37+
try:
38+
import zarr
39+
40+
if zarr.__version__ >= "3":
41+
raise RuntimeError(
42+
f"zarr version {zarr.__version__} is not supported. "
43+
"tsinfer requires zarr < 3.0. Please install zarr < 3.0."
44+
)
45+
except ImportError:
46+
pass
47+
3748
__version__ = "undefined"
3849
try:
3950
from . import _version

0 commit comments

Comments
 (0)