Skip to content

Commit 3f22780

Browse files
authored
Merge branch 'zarr-developers:main' into main
2 parents 1e81463 + a7a698d commit 3f22780

File tree

14 files changed

+801
-16
lines changed

14 files changed

+801
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
python-version: ["3.11", "3.12", "3.13"]
16-
# macos-12 is an intel runner, macos-14 is a arm64 runner
17-
platform: [ubuntu-latest, windows-latest, macos-12, macos-14]
16+
# macos-13 is an intel runner, macos-14 is a arm64 runner
17+
platform: [ubuntu-latest, windows-latest, macos-13, macos-14]
1818

1919
steps:
2020
- name: Checkout source
@@ -23,7 +23,7 @@ jobs:
2323
submodules: recursive
2424

2525
- name: Set up Conda
26-
uses: conda-incubator/setup-miniconda@v3.0.4
26+
uses: conda-incubator/setup-miniconda@v3.1.0
2727
with:
2828
channels: conda-forge
2929
miniforge-version: latest
@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: Install clang
4747
shell: "bash -l {0}"
48-
if: matrix.platform == 'macos-12'
48+
if: matrix.platform == 'macos-13'
4949
run: |
5050
conda activate env
5151
conda install -y 'clang>=12.0.1,<17'
@@ -70,14 +70,23 @@ jobs:
7070
conda activate env
7171
python -m pip install -v ".[pcodec]"
7272
73+
- name: Install zarr-python
74+
shell: "bash -l {0}"
75+
# Since zarr v3 requires numpy >= 1.25, on Python 3.11 leave it out
76+
# so we can have some tests of our minimum version of numpy (1.24)
77+
if: matrix.python-version != '3.11'
78+
run: |
79+
conda activate env
80+
# TODO: remove --pre option when zarr v3 is out
81+
python -m pip install --pre zarr
7382
7483
# This is used to test with zfpy, which does not yet support numpy 2.0
7584
- name: Install older numpy and zfpy
7685
if: matrix.python-version == '3.11'
7786
shell: "bash -l {0}"
7887
run: |
7988
conda activate env
80-
python -m pip install "zfpy>=1" "numpy<2"
89+
python -m pip install -v ".[zfpy]"
8190
8291
- name: List installed packages
8392
shell: "bash -l {0}"

.github/workflows/wheel.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
# macos-12 is an intel runner, macos-14 is a arm64 runner
17-
os: [ubuntu-latest, windows-latest, macos-12, macos-14]
16+
# macos-13 is an intel runner, macos-14 is a arm64 runner
17+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
1818
env:
1919
CIBW_TEST_COMMAND: python -c "import numcodecs"
2020
CIBW_BUILD: "cp311-* cp312-* cp313-*"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
- id: debug-statements
1616

1717
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: v0.7.1
18+
rev: v0.7.2
1919
hooks:
2020
- id: ruff
2121
args: ["--fix", "--show-fixes"]

.readthedocs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ build:
77
os: ubuntu-20.04
88
tools:
99
python: "3.12"
10+
jobs:
11+
post_install:
12+
- python -m pip install --pre 'zarr'
1013

1114
sphinx:
1215
configuration: docs/conf.py
@@ -19,3 +22,4 @@ python:
1922
- docs
2023
- msgpack
2124
- zfpy
25+
- crc32c

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ API reference
1010
checksum32
1111
abc
1212
registry
13+
zarr3

docs/release.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ Fix
2222

2323
Enhancements
2424
~~~~~~~~~~~~
25-
* Add Crc32c checksum codec
25+
* Add Crc32c checksum codec.
2626
By :user:`Norman Rzepka <normanrz>`, :issue:`613`.
27+
* Add codec wrappers for Zarr 3.
28+
By :user:`Norman Rzepka <normanrz>`, :issue:`524`
2729

2830
Maintenance
2931
~~~~~~~~~~~

docs/zarr3.rst

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
Zarr 3 codecs
2+
=============
3+
.. automodule:: numcodecs.zarr3
4+
5+
6+
Bytes-to-bytes codecs
7+
---------------------
8+
.. autoclass:: Blosc()
9+
10+
.. autoattribute:: codec_name
11+
12+
.. autoclass:: LZ4()
13+
14+
.. autoattribute:: codec_name
15+
16+
.. autoclass:: Zstd()
17+
18+
.. autoattribute:: codec_name
19+
20+
.. autoclass:: Zlib()
21+
22+
.. autoattribute:: codec_name
23+
24+
.. autoclass:: GZip()
25+
26+
.. autoattribute:: codec_name
27+
28+
.. autoclass:: BZ2()
29+
30+
.. autoattribute:: codec_name
31+
32+
.. autoclass:: LZMA()
33+
34+
.. autoattribute:: codec_name
35+
36+
.. autoclass:: Shuffle()
37+
38+
.. autoattribute:: codec_name
39+
40+
41+
Array-to-array codecs
42+
---------------------
43+
.. autoclass:: Delta()
44+
45+
.. autoattribute:: codec_name
46+
47+
.. autoclass:: BitRound()
48+
49+
.. autoattribute:: codec_name
50+
51+
.. autoclass:: FixedScaleOffset()
52+
53+
.. autoattribute:: codec_name
54+
55+
.. autoclass:: Quantize()
56+
57+
.. autoattribute:: codec_name
58+
59+
.. autoclass:: PackBits()
60+
61+
.. autoattribute:: codec_name
62+
63+
.. autoclass:: AsType()
64+
65+
.. autoattribute:: codec_name
66+
67+
68+
Bytes-to-bytes checksum codecs
69+
------------------------------
70+
.. autoclass:: CRC32()
71+
72+
.. autoattribute:: codec_name
73+
74+
.. autoclass:: CRC32C()
75+
76+
.. autoattribute:: codec_name
77+
78+
.. autoclass:: Adler32()
79+
80+
.. autoattribute:: codec_name
81+
82+
.. autoclass:: Fletcher32()
83+
84+
.. autoattribute:: codec_name
85+
86+
.. autoclass:: JenkinsLookup3()
87+
88+
.. autoattribute:: codec_name
89+
90+
91+
Array-to-bytes codecs
92+
---------------------
93+
.. autoclass:: PCodec()
94+
95+
.. autoattribute:: codec_name
96+
97+
.. autoclass:: ZFPY()
98+
99+
.. autoattribute:: codec_name

numcodecs/tests/test_compat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ def test_ensure_bytes_invalid_inputs():
6464
ensure_bytes(e)
6565

6666

67+
@pytest.mark.filterwarnings(
68+
"ignore:The 'u' type code is deprecated and will be removed in Python 3.16"
69+
)
6770
def test_ensure_contiguous_ndarray_invalid_inputs():
6871
# object array not allowed
6972
a = np.array(['Xin chào thế giới'], dtype=object)

numcodecs/tests/test_fixedscaleoffset.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,20 @@ def test_encode_decode():
3636
check_encode_decode(arr, codec, precision=precision)
3737

3838

39-
def test_encode():
39+
@pytest.mark.parametrize(
40+
("offset", "scale", "expected"),
41+
[
42+
(1000, 10, [0, 6, 11, 17, 22, 28, 33, 39, 44, 50]),
43+
(1002.5, 10, [-25, -19, -14, -8, -3, 3, 8, 14, 19, 25]),
44+
(1000, 0.5, [0, 0, 1, 1, 1, 1, 2, 2, 2, 2]),
45+
],
46+
)
47+
def test_encode(offset: float, scale: float, expected: list[int]):
4048
dtype = '<f8'
41-
astype = '|u1'
42-
codec = FixedScaleOffset(scale=10, offset=1000, dtype=dtype, astype=astype)
43-
arr = np.linspace(1000, 1001, 10, dtype=dtype)
44-
expect = np.array([0, 1, 2, 3, 4, 6, 7, 8, 9, 10], dtype=astype)
49+
astype = np.int16
50+
codec = FixedScaleOffset(scale=scale, offset=offset, dtype=dtype, astype=astype)
51+
arr = np.linspace(1000, 1005, 10, dtype=dtype)
52+
expect = np.array(expected, dtype=astype)
4553
actual = codec.encode(arr)
4654
assert_array_equal(expect, actual)
4755
assert np.dtype(astype) == actual.dtype

numcodecs/tests/test_msgpacks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ def test_backwards_compatibility():
5555
check_backwards_compatibility(codec.codec_id, arrays, [codec])
5656

5757

58+
@pytest.mark.filterwarnings(
59+
"ignore:Creating an ndarray from ragged nested sequences .* is deprecated.*"
60+
)
5861
@pytest.mark.parametrize(
5962
("input_data", "dtype"),
6063
[

0 commit comments

Comments
 (0)