Skip to content

Commit a62d258

Browse files
committed
moves zarr3 to private module, adds test for zarr-python2 installs
1 parent 860956f commit a62d258

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
python-version: ["3.10", "3.11", "3.12"]
1616
# macos-12 is an intel runner, macos-14 is a arm64 runner
1717
platform: [ubuntu-latest, windows-latest, macos-12, macos-14]
18+
zarr-version: [">=2,<3", "==3.0.0b0"]
1819

1920
steps:
2021
- name: Checkout source
@@ -68,7 +69,7 @@ jobs:
6869
shell: "bash -l {0}"
6970
run: |
7071
conda activate env
71-
python -m pip install zarr==3.0.0b0
72+
python -m pip install zarr${{ matrix.zarr-version }}
7273
7374
# This is used to test with zfpy, which does not yet support numpy 2.0
7475
- name: Install older numpy and zfpy

numcodecs/zarr3.py renamed to numcodecs/_zarr3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
try:
1414
import zarr
1515

16-
assert zarr.__version__ >= "3.0.0"
16+
if zarr.__version__ < "3.0.0":
17+
raise ImportError("zarr 3.0.0 or later is required to use the numcodecs zarr integration.")
1718
except ImportError:
1819
raise ImportError("zarr 3.0.0 or later is required to use the numcodecs zarr integration.")
1920

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from __future__ import annotations
2+
import pytest
3+
4+
5+
def test_zarr3_import():
6+
try:
7+
import zarr
8+
except ImportError:
9+
pass
10+
11+
if zarr is None or zarr.__version__ < "3.0.0":
12+
with pytest.raises(ImportError):
13+
import numcodecs._zarr3 # noqa: F401

pyproject.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,26 @@ pcodec = [
7272
]
7373

7474
[project.entry-points."zarr.codecs"]
75-
"numcodecs.blosc" = "numcodecs.zarr3:BloscCodec"
76-
"numcodecs.lz4" = "numcodecs.zarr3:Lz4Codec"
77-
"numcodecs.zstd" = "numcodecs.zarr3:ZstdCodec"
78-
"numcodecs.zlib" = "numcodecs.zarr3:ZlibCodec"
79-
"numcodecs.gzip" = "numcodecs.zarr3:GzipCodec"
80-
"numcodecs.bz2" = "numcodecs.zarr3:Bz2Codec"
81-
"numcodecs.lzma" = "numcodecs.zarr3:LzmaCodec"
82-
"numcodecs.shuffle" = "numcodecs.zarr3:ShuffleCodec"
83-
"numcodecs.delta" = "numcodecs.zarr3:DeltaCodec"
84-
"numcodecs.bitround" = "numcodecs.zarr3:BitroundCodec"
85-
"numcodecs.fixedscaleoffset" = "numcodecs.zarr3:FixedScaleOffsetCodec"
86-
"numcodecs.quantize" = "numcodecs.zarr3:QuantizeCodec"
87-
"numcodecs.packbits" = "numcodecs.zarr3:PackbitsCodec"
88-
"numcodecs.astype" = "numcodecs.zarr3:AsTypeCodec"
89-
"numcodecs.crc32" = "numcodecs.zarr3:Crc32Codec"
90-
"numcodecs.adler32" = "numcodecs.zarr3:Adler32Codec"
91-
"numcodecs.fletcher32" = "numcodecs.zarr3:Fletcher32Codec"
92-
"numcodecs.jenkins_lookup3" = "numcodecs.zarr3:JenkinsLookup3Codec"
93-
"numcodecs.pcodec" = "numcodecs.zarr3:PCodecCodec"
94-
"numcodecs.zfpy" = "numcodecs.zarr3:ZFPYCodec"
75+
"numcodecs.blosc" = "numcodecs._zarr3:BloscCodec"
76+
"numcodecs.lz4" = "numcodecs._zarr3:Lz4Codec"
77+
"numcodecs.zstd" = "numcodecs._zarr3:ZstdCodec"
78+
"numcodecs.zlib" = "numcodecs._zarr3:ZlibCodec"
79+
"numcodecs.gzip" = "numcodecs._zarr3:GzipCodec"
80+
"numcodecs.bz2" = "numcodecs._zarr3:Bz2Codec"
81+
"numcodecs.lzma" = "numcodecs._zarr3:LzmaCodec"
82+
"numcodecs.shuffle" = "numcodecs._zarr3:ShuffleCodec"
83+
"numcodecs.delta" = "numcodecs._zarr3:DeltaCodec"
84+
"numcodecs.bitround" = "numcodecs._zarr3:BitroundCodec"
85+
"numcodecs.fixedscaleoffset" = "numcodecs._zarr3:FixedScaleOffsetCodec"
86+
"numcodecs.quantize" = "numcodecs._zarr3:QuantizeCodec"
87+
"numcodecs.packbits" = "numcodecs._zarr3:PackbitsCodec"
88+
"numcodecs.astype" = "numcodecs._zarr3:AsTypeCodec"
89+
"numcodecs.crc32" = "numcodecs._zarr3:Crc32Codec"
90+
"numcodecs.adler32" = "numcodecs._zarr3:Adler32Codec"
91+
"numcodecs.fletcher32" = "numcodecs._zarr3:Fletcher32Codec"
92+
"numcodecs.jenkins_lookup3" = "numcodecs._zarr3:JenkinsLookup3Codec"
93+
"numcodecs.pcodec" = "numcodecs._zarr3:PCodecCodec"
94+
"numcodecs.zfpy" = "numcodecs._zarr3:ZFPYCodec"
9595

9696
[tool.setuptools]
9797
license-files = ["LICENSE.txt"]

0 commit comments

Comments
 (0)