Skip to content

Commit 86323eb

Browse files
Bring back numcodecs version check
1 parent 9212c0e commit 86323eb

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

.github/workflows/emscripten.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,19 @@ jobs:
7171
with:
7272
# See https://github.com/zarr-developers/numcodecs/pull/529
7373
repository: agriyakhetarpal/numcodecs
74-
ref: setup-emscripten-ci
74+
# ref: setup-emscripten-ci
7575
path: numcodecs-wasm
7676
submodules: recursive
7777
fetch-depth: 0
7878
fetch-tags: true
7979

8080
# For some reason fetch-depth: 0 and fetch-tags: true aren't working...
81-
- name: Manually fetch tags for numcodecs
82-
working-directory: numcodecs-wasm
83-
run: git fetch --tags
81+
- name: Manually switch branch for numcodecs
82+
run: |
83+
cd numcodecs-wasm
84+
git checkout setup-emscripten-ci
85+
git fetch --unshallow || git fetch --all
86+
git fetch --tags
8487
8588
- name: Build numcodecs for WASM
8689
run: pyodide build
@@ -100,13 +103,7 @@ jobs:
100103
# Install numcodecs
101104
pip install $(ls numcodecs-wasm/dist/*.whl)"[crc32c]"
102105
103-
# Install Zarr without dependencies until we can figure out the
104-
# numcodecs wheel versioning issue
105-
pip install dist/*.whl --no-deps
106-
pip install "packaging>=22.0" "numpy>=1.25" "typing_extensions>=4.9" "donfig>=0.8"
107-
108-
# Install test dependencies
109-
pip install "coverage" "pytest" "pytest-asyncio" "pytest-cov" "pytest-accept" "rich" "mypy" "hypothesis"
106+
# Install Zarr and test dependencies
107+
pip install $(ls dist/*.whl)"[test]"
110108
111109
python -m pytest tests -v --cov=zarr --cov-config=pyproject.toml
112-

src/zarr/codecs/zstd.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
from functools import cached_property
66
from typing import TYPE_CHECKING
77

8+
import numcodecs
89
from numcodecs.zstd import Zstd
10+
from packaging.version import Version
911

1012
from zarr.abc.codec import BytesBytesCodec
1113
from zarr.core.buffer.cpu import as_numpy_array_wrapper
@@ -42,12 +44,12 @@ class ZstdCodec(BytesBytesCodec):
4244

4345
def __init__(self, *, level: int = 0, checksum: bool = False) -> None:
4446
# numcodecs 0.13.0 introduces the checksum attribute for the zstd codec
45-
# _numcodecs_version = Version(numcodecs.__version__)
46-
# if _numcodecs_version < Version("0.13.0"):
47-
# raise RuntimeError(
48-
# "numcodecs version >= 0.13.0 is required to use the zstd codec. "
49-
# f"Version {_numcodecs_version} is currently installed."
50-
# )
47+
_numcodecs_version = Version(numcodecs.__version__)
48+
if _numcodecs_version < Version("0.13.0"):
49+
raise RuntimeError(
50+
"numcodecs version >= 0.13.0 is required to use the zstd codec. "
51+
f"Version {_numcodecs_version} is currently installed."
52+
)
5153

5254
level_parsed = parse_zstd_level(level)
5355
checksum_parsed = parse_checksum(checksum)

0 commit comments

Comments
 (0)