diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e2bac06..757436d0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,13 +48,7 @@ jobs: conda list --show-channel-urls - name: Install numcodecs - run: | - # TODO: Remove this conditional when pcodec supports Python 3.14 - if [[ "${{ matrix.python-version }}" == "3.14" ]]; then - python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]" - else - python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" - fi + run: python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" - name: List installed packages run: python -m pip list diff --git a/fixture/pcodec/codec.10/config.json b/fixture/pcodec/codec.10/config.json new file mode 100644 index 00000000..f5ae0a54 --- /dev/null +++ b/fixture/pcodec/codec.10/config.json @@ -0,0 +1,9 @@ +{ + "delta_encoding_order": null, + "delta_spec": "no_op", + "equal_pages_up_to": 262144, + "id": "pcodec", + "level": 8, + "mode_spec": "auto", + "paging_spec": "equal_pages_up_to" +} \ No newline at end of file diff --git a/fixture/pcodec/codec.10/encoded.00.dat b/fixture/pcodec/codec.10/encoded.00.dat new file mode 100644 index 00000000..77351ac6 Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.00.dat differ diff --git a/fixture/pcodec/codec.10/encoded.01.dat b/fixture/pcodec/codec.10/encoded.01.dat new file mode 100644 index 00000000..27aa7746 Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.01.dat differ diff --git a/fixture/pcodec/codec.10/encoded.02.dat b/fixture/pcodec/codec.10/encoded.02.dat new file mode 100644 index 00000000..cb40ea06 Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.02.dat differ diff --git a/fixture/pcodec/codec.10/encoded.03.dat b/fixture/pcodec/codec.10/encoded.03.dat new file mode 100644 index 00000000..7f95971e Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.03.dat differ diff --git a/fixture/pcodec/codec.10/encoded.04.dat b/fixture/pcodec/codec.10/encoded.04.dat new file mode 100644 index 00000000..658d8487 Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.04.dat differ diff --git a/fixture/pcodec/codec.10/encoded.05.dat b/fixture/pcodec/codec.10/encoded.05.dat new file mode 100644 index 00000000..cbc5f158 Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.05.dat differ diff --git a/fixture/pcodec/codec.10/encoded.06.dat b/fixture/pcodec/codec.10/encoded.06.dat new file mode 100644 index 00000000..bc2bae9b Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.06.dat differ diff --git a/fixture/pcodec/codec.10/encoded.07.dat b/fixture/pcodec/codec.10/encoded.07.dat new file mode 100644 index 00000000..658ab676 Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.07.dat differ diff --git a/fixture/pcodec/codec.10/encoded.08.dat b/fixture/pcodec/codec.10/encoded.08.dat new file mode 100644 index 00000000..71b72e72 Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.08.dat differ diff --git a/fixture/pcodec/codec.10/encoded.09.dat b/fixture/pcodec/codec.10/encoded.09.dat new file mode 100644 index 00000000..0e71ca3d Binary files /dev/null and b/fixture/pcodec/codec.10/encoded.09.dat differ diff --git a/pyproject.toml b/pyproject.toml index 878c912a..2efc601b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ zfpy = [ "zfpy>=1.0.0" ] pcodec = [ - "pcodec>=0.3,<0.4", + "pcodec>=1,<2", ] crc32c = [ "crc32c>=2.7", @@ -153,6 +153,7 @@ xfail_strict = true filterwarnings = [ "error", "ignore:As the c extension couldn't be imported:RuntimeWarning", # Ignore warning about pure python google_crc32c (on Python 3.14) + "ignore:.*align should be passed as Python or NumPy boolean.*:numpy.exceptions.VisibleDeprecationWarning", # Old fixture files trigger numpy-internal dtype(align=0) warning (NumPy 2.4+) ] [tool.cibuildwheel] diff --git a/src/numcodecs/pcodec.py b/src/numcodecs/pcodec.py index 79732f2f..c7108c7b 100644 --- a/src/numcodecs/pcodec.py +++ b/src/numcodecs/pcodec.py @@ -1,3 +1,4 @@ +import warnings from typing import Literal from pcodec import ChunkConfig, DeltaSpec, ModeSpec, PagingSpec, standalone @@ -28,9 +29,10 @@ class PCodec(Codec): structure of the data (e.g. approximate multiples of 0.1) to improve compression ratio, or skip this step and just use the numbers as-is (Classic mode). Note that the "try*" specs are not currently supported. - delta_spec : {"auto", "none", "try_consecutive", "try_lookback"} + delta_spec : {"auto", "no_op", "none", "try_consecutive", "try_lookback"} Configures the delta encoding strategy. By default, uses "auto" which - will try to infer the best encoding order. + will try to infer the best encoding order. "none" is deprecated in favor + of "no_op". paging_spec : {"equal_pages_up_to"} Configures the paging strategy. Only "equal_pages_up_to" is currently supported. @@ -49,7 +51,7 @@ def __init__( level: int = 8, *, mode_spec: Literal["auto", "classic"] = "auto", - delta_spec: Literal["auto", "none", "try_consecutive", "try_lookback"] = "auto", + delta_spec: Literal["auto", "no_op", "none", "try_consecutive", "try_lookback"] = "auto", paging_spec: Literal["equal_pages_up_to"] = "equal_pages_up_to", delta_encoding_order: int | None = None, equal_pages_up_to: int = DEFAULT_MAX_PAGE_N, @@ -83,8 +85,15 @@ def _get_chunk_config(self): match self.delta_spec: case "auto": delta_spec = DeltaSpec.auto() - case "none": - delta_spec = DeltaSpec.none() + case "none": # legacy + warnings.warn( + "delta_spec='none' is deprecated and will be removed in a future version. Use 'no_op' instead.", + DeprecationWarning, + stacklevel=1, + ) + delta_spec = DeltaSpec.no_op() + case "no_op": + delta_spec = DeltaSpec.no_op() case "try_consecutive": delta_spec = DeltaSpec.try_consecutive(self.delta_encoding_order) case "try_lookback": diff --git a/tests/test_pcodec.py b/tests/test_pcodec.py index e34d6658..0ac19a7e 100644 --- a/tests/test_pcodec.py +++ b/tests/test_pcodec.py @@ -26,6 +26,7 @@ PCodec(delta_spec="try_lookback"), PCodec(delta_spec="none"), PCodec(delta_spec="try_consecutive", delta_encoding_order=1), + PCodec(delta_spec="no_op"), ] @@ -48,6 +49,7 @@ @pytest.mark.parametrize("arr", arrays) @pytest.mark.parametrize("codec", codecs) +@pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_encode_decode(arr, codec): check_encode_decode_array(arr, codec)