numcodecs 0.16.1__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.16.2__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of numcodecs might be problematic. Click here for more details.

Files changed (31) hide show
  1. numcodecs/_shuffle.cpython-312-aarch64-linux-gnu.so +0 -0
  2. numcodecs/abc.py +1 -2
  3. numcodecs/blosc.cpython-312-aarch64-linux-gnu.so +0 -0
  4. numcodecs/checksum32.py +2 -2
  5. numcodecs/compat_ext.cpython-312-aarch64-linux-gnu.so +0 -0
  6. numcodecs/fletcher32.cpython-312-aarch64-linux-gnu.so +0 -0
  7. numcodecs/jenkins.cpython-312-aarch64-linux-gnu.so +0 -0
  8. numcodecs/lz4.cpython-312-aarch64-linux-gnu.so +0 -0
  9. numcodecs/lzma.py +1 -2
  10. numcodecs/tests/test_pyzstd.py +77 -0
  11. numcodecs/tests/test_zarr3.py +12 -12
  12. numcodecs/tests/test_zstd.py +72 -6
  13. numcodecs/version.py +2 -2
  14. numcodecs/vlen.cpython-312-aarch64-linux-gnu.so +0 -0
  15. numcodecs/zarr3.py +42 -12
  16. numcodecs/zfpy.py +1 -2
  17. numcodecs/zstd.cpython-312-aarch64-linux-gnu.so +0 -0
  18. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/METADATA +2 -1
  19. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/RECORD +31 -30
  20. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/WHEEL +1 -1
  21. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/entry_points.txt +0 -0
  22. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/LICENSE.txt +0 -0
  23. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSE.txt +0 -0
  24. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSES/BITSHUFFLE.txt +0 -0
  25. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSES/FASTLZ.txt +0 -0
  26. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSES/LZ4.txt +0 -0
  27. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSES/SNAPPY.txt +0 -0
  28. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSES/STDINT.txt +0 -0
  29. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSES/ZLIB-NG.txt +0 -0
  30. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/licenses/c-blosc/LICENSES/ZLIB.txt +0 -0
  31. {numcodecs-0.16.1.dist-info → numcodecs-0.16.2.dist-info}/top_level.txt +0 -0
numcodecs/abc.py CHANGED
@@ -29,14 +29,13 @@ other and vice versa.
29
29
  """
30
30
 
31
31
  from abc import ABC, abstractmethod
32
- from typing import Optional
33
32
 
34
33
 
35
34
  class Codec(ABC):
36
35
  """Codec abstract base class."""
37
36
 
38
37
  # override in sub-class
39
- codec_id: Optional[str] = None
38
+ codec_id: str | None = None
40
39
  """Codec identifier."""
41
40
 
42
41
  @abstractmethod
numcodecs/checksum32.py CHANGED
@@ -3,7 +3,7 @@ import struct
3
3
  import zlib
4
4
  from contextlib import suppress
5
5
  from types import ModuleType
6
- from typing import Literal, Optional
6
+ from typing import Literal
7
7
 
8
8
  import numpy as np
9
9
  from typing_extensions import Buffer
@@ -12,7 +12,7 @@ from .abc import Codec
12
12
  from .compat import ensure_contiguous_ndarray, ndarray_copy
13
13
  from .jenkins import jenkins_lookup3
14
14
 
15
- _crc32c: Optional[ModuleType] = None
15
+ _crc32c: ModuleType | None = None
16
16
  with suppress(ImportError):
17
17
  import crc32c as _crc32c # type: ignore[no-redef, unused-ignore]
18
18
 
numcodecs/lzma.py CHANGED
@@ -1,7 +1,6 @@
1
1
  from types import ModuleType
2
- from typing import Optional
3
2
 
4
- _lzma: Optional[ModuleType] = None
3
+ _lzma: ModuleType | None = None
5
4
  try:
6
5
  import lzma as _lzma
7
6
  except ImportError: # pragma: no cover
@@ -0,0 +1,77 @@
1
+ # Check Zstd against pyzstd package
2
+
3
+ import numpy as np
4
+ import pytest
5
+ import pyzstd
6
+
7
+ from numcodecs.zstd import Zstd
8
+
9
+ test_data = [
10
+ b"Hello World!",
11
+ np.arange(113).tobytes(),
12
+ np.arange(10, 15).tobytes(),
13
+ np.random.randint(3, 50, size=(53,), dtype=np.uint16).tobytes(),
14
+ ]
15
+
16
+
17
+ @pytest.mark.parametrize("input", test_data)
18
+ def test_pyzstd_simple(input):
19
+ """
20
+ Test if Zstd.[decode, encode] can perform the inverse operation to
21
+ pyzstd.[compress, decompress] in the simple case.
22
+ """
23
+ z = Zstd()
24
+ assert z.decode(pyzstd.compress(input)) == input
25
+ assert pyzstd.decompress(z.encode(input)) == input
26
+
27
+
28
+ @pytest.mark.xfail
29
+ @pytest.mark.parametrize("input", test_data)
30
+ def test_pyzstd_simple_multiple_frames_decode(input):
31
+ """
32
+ Test decompression of two concatenated frames of known sizes
33
+
34
+ numcodecs.zstd.Zstd currently fails because it only assesses the size of the
35
+ first frame. Rather, it should keep iterating through all the frames until
36
+ the end of the input buffer.
37
+ """
38
+ z = Zstd()
39
+ assert pyzstd.decompress(pyzstd.compress(input) * 2) == input * 2
40
+ assert z.decode(pyzstd.compress(input) * 2) == input * 2
41
+
42
+
43
+ @pytest.mark.parametrize("input", test_data)
44
+ def test_pyzstd_simple_multiple_frames_encode(input):
45
+ """
46
+ Test if pyzstd can decompress two concatenated frames from Zstd.encode
47
+ """
48
+ z = Zstd()
49
+ assert pyzstd.decompress(z.encode(input) * 2) == input * 2
50
+
51
+
52
+ @pytest.mark.parametrize("input", test_data)
53
+ def test_pyzstd_streaming(input):
54
+ """
55
+ Test if Zstd can decode a single frame and concatenated frames in streaming
56
+ mode where the decompressed size is not recorded in the frame header.
57
+ """
58
+ pyzstd_c = pyzstd.ZstdCompressor()
59
+ pyzstd_d = pyzstd.ZstdDecompressor()
60
+ pyzstd_e = pyzstd.EndlessZstdDecompressor()
61
+ z = Zstd()
62
+
63
+ d_bytes = input
64
+ pyzstd_c.compress(d_bytes)
65
+ c_bytes = pyzstd_c.flush()
66
+ assert z.decode(c_bytes) == d_bytes
67
+ assert pyzstd_d.decompress(z.encode(d_bytes)) == d_bytes
68
+
69
+ # Test multiple streaming frames
70
+ assert z.decode(c_bytes * 2) == pyzstd_e.decompress(c_bytes * 2)
71
+ assert z.decode(c_bytes * 3) == pyzstd_e.decompress(c_bytes * 3)
72
+ assert z.decode(c_bytes * 4) == pyzstd_e.decompress(c_bytes * 4)
73
+ assert z.decode(c_bytes * 5) == pyzstd_e.decompress(c_bytes * 5)
74
+ assert z.decode(c_bytes * 7) == pyzstd_e.decompress(c_bytes * 7)
75
+ assert z.decode(c_bytes * 11) == pyzstd_e.decompress(c_bytes * 11)
76
+ assert z.decode(c_bytes * 13) == pyzstd_e.decompress(c_bytes * 13)
77
+ assert z.decode(c_bytes * 99) == pyzstd_e.decompress(c_bytes * 99)
@@ -122,8 +122,8 @@ def test_generic_filter(
122
122
  ],
123
123
  )
124
124
 
125
- a[:, :] = data.copy()
126
- a = zarr.open_array(store / "generic", mode="r")
125
+ a[:, :] = data.copy()
126
+ a = zarr.open_array(store / "generic", mode="r")
127
127
  np.testing.assert_array_equal(data, a[:, :])
128
128
 
129
129
 
@@ -140,8 +140,8 @@ def test_generic_filter_bitround(store: StorePath):
140
140
  filters=[numcodecs.zarr3.BitRound(keepbits=3)],
141
141
  )
142
142
 
143
- a[:, :] = data.copy()
144
- a = zarr.open_array(store / "generic_bitround", mode="r")
143
+ a[:, :] = data.copy()
144
+ a = zarr.open_array(store / "generic_bitround", mode="r")
145
145
  assert np.allclose(data, a[:, :], atol=0.1)
146
146
 
147
147
 
@@ -158,8 +158,8 @@ def test_generic_filter_quantize(store: StorePath):
158
158
  filters=[numcodecs.zarr3.Quantize(digits=3)],
159
159
  )
160
160
 
161
- a[:, :] = data.copy()
162
- a = zarr.open_array(store / "generic_quantize", mode="r")
161
+ a[:, :] = data.copy()
162
+ a = zarr.open_array(store / "generic_quantize", mode="r")
163
163
  assert np.allclose(data, a[:, :], atol=0.001)
164
164
 
165
165
 
@@ -177,8 +177,8 @@ def test_generic_filter_packbits(store: StorePath):
177
177
  filters=[numcodecs.zarr3.PackBits()],
178
178
  )
179
179
 
180
- a[:, :] = data.copy()
181
- a = zarr.open_array(store / "generic_packbits", mode="r")
180
+ a[:, :] = data.copy()
181
+ a = zarr.open_array(store / "generic_packbits", mode="r")
182
182
  np.testing.assert_array_equal(data, a[:, :])
183
183
 
184
184
  with pytest.raises(ValueError, match=".*requires bool dtype.*"):
@@ -217,8 +217,8 @@ def test_generic_checksum(
217
217
  compressors=[codec_class()],
218
218
  )
219
219
 
220
- a[:, :] = data.copy()
221
- a = zarr.open_array(store / "generic_checksum", mode="r")
220
+ a[:, :] = data.copy()
221
+ a = zarr.open_array(store / "generic_checksum", mode="r")
222
222
  np.testing.assert_array_equal(data, a[:, :])
223
223
 
224
224
 
@@ -267,8 +267,8 @@ def test_delta_astype(store: StorePath):
267
267
  ],
268
268
  )
269
269
 
270
- a[:, :] = data.copy()
271
- a = zarr.open_array(store / "generic", mode="r")
270
+ a[:, :] = data.copy()
271
+ a = zarr.open_array(store / "generic", mode="r")
272
272
  np.testing.assert_array_equal(data, a[:, :])
273
273
 
274
274
 
@@ -1,14 +1,9 @@
1
1
  import itertools
2
+ import subprocess
2
3
 
3
4
  import numpy as np
4
5
  import pytest
5
6
 
6
- try:
7
- from numcodecs.zstd import Zstd
8
- except ImportError: # pragma: no cover
9
- pytest.skip("numcodecs.zstd not available", allow_module_level=True)
10
-
11
-
12
7
  from numcodecs.tests.common import (
13
8
  check_backwards_compatibility,
14
9
  check_config,
@@ -17,6 +12,7 @@ from numcodecs.tests.common import (
17
12
  check_err_encode_object_buffer,
18
13
  check_repr,
19
14
  )
15
+ from numcodecs.zstd import Zstd
20
16
 
21
17
  codecs = [
22
18
  Zstd(),
@@ -90,3 +86,73 @@ def test_native_functions():
90
86
  assert Zstd.default_level() == 3
91
87
  assert Zstd.min_level() == -131072
92
88
  assert Zstd.max_level() == 22
89
+
90
+
91
+ def test_streaming_decompression():
92
+ # Test input frames with unknown frame content size
93
+ codec = Zstd()
94
+
95
+ # If the zstd command line interface is available, check the bytes
96
+ cli = zstd_cli_available()
97
+ if cli:
98
+ view_zstd_streaming_bytes()
99
+
100
+ # Encode bytes directly that were the result of streaming compression
101
+ bytes_val = b'(\xb5/\xfd\x00Xa\x00\x00Hello World!'
102
+ dec = codec.decode(bytes_val)
103
+ dec_expected = b'Hello World!'
104
+ assert dec == dec_expected
105
+ if cli:
106
+ assert bytes_val == generate_zstd_streaming_bytes(dec_expected)
107
+ assert dec_expected == generate_zstd_streaming_bytes(bytes_val, decompress=True)
108
+
109
+ # Two consecutive frames given as input
110
+ bytes2 = bytes(bytearray(bytes_val * 2))
111
+ dec2 = codec.decode(bytes2)
112
+ dec2_expected = b'Hello World!Hello World!'
113
+ assert dec2 == dec2_expected
114
+ if cli:
115
+ assert dec2_expected == generate_zstd_streaming_bytes(bytes2, decompress=True)
116
+
117
+ # Single long frame that decompresses to a large output
118
+ bytes3 = b'(\xb5/\xfd\x00X$\x02\x00\xa4\x03ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz\x01\x00:\xfc\xdfs\x05\x05L\x00\x00\x08s\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08k\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08c\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08[\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08S\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08K\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08C\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08u\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08m\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08e\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08]\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08U\x01\x00\xfc\xff9\x10\x02L\x00\x00\x08M\x01\x00\xfc\xff9\x10\x02M\x00\x00\x08E\x01\x00\xfc\x7f\x1d\x08\x01'
119
+ dec3 = codec.decode(bytes3)
120
+ dec3_expected = b'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz' * 1024 * 32
121
+ assert dec3 == dec3_expected
122
+ if cli:
123
+ assert bytes3 == generate_zstd_streaming_bytes(dec3_expected)
124
+ assert dec3_expected == generate_zstd_streaming_bytes(bytes3, decompress=True)
125
+
126
+ # Garbage input results in an error
127
+ bytes4 = bytes(bytearray([0, 0, 0, 0, 0, 0, 0, 0]))
128
+ with pytest.raises(RuntimeError, match='Zstd decompression error: invalid input data'):
129
+ codec.decode(bytes4)
130
+
131
+
132
+ def generate_zstd_streaming_bytes(input: bytes, *, decompress: bool = False) -> bytes:
133
+ """
134
+ Use the zstd command line interface to compress or decompress bytes in streaming mode.
135
+ """
136
+ if decompress:
137
+ args = ["-d"]
138
+ else:
139
+ args = []
140
+
141
+ p = subprocess.run(["zstd", "--no-check", *args], input=input, capture_output=True)
142
+ return p.stdout
143
+
144
+
145
+ def view_zstd_streaming_bytes():
146
+ bytes_val = generate_zstd_streaming_bytes(b"Hello world!")
147
+ print(f" bytes_val = {bytes_val}")
148
+
149
+ bytes3 = generate_zstd_streaming_bytes(
150
+ b"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz" * 1024 * 32
151
+ )
152
+ print(f" bytes3 = {bytes3}")
153
+
154
+
155
+ def zstd_cli_available() -> bool:
156
+ return not subprocess.run(
157
+ ["zstd", "-V"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
158
+ ).returncode
numcodecs/version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.16.1'
21
- __version_tuple__ = version_tuple = (0, 16, 1)
20
+ __version__ = version = '0.16.2'
21
+ __version_tuple__ = version_tuple = (0, 16, 2)
numcodecs/zarr3.py CHANGED
@@ -29,17 +29,19 @@ import asyncio
29
29
  import math
30
30
  from dataclasses import dataclass, replace
31
31
  from functools import cached_property
32
+ from importlib.metadata import version
32
33
  from typing import Any, Self
33
34
  from warnings import warn
34
35
 
35
36
  import numpy as np
37
+ from packaging.version import Version
36
38
 
37
39
  import numcodecs
38
40
 
39
41
  try:
40
- import zarr
42
+ import zarr # noqa: F401
41
43
 
42
- if zarr.__version__ < "3.0.0": # pragma: no cover
44
+ if Version(version('zarr')) < Version("3.0.0"): # pragma: no cover
43
45
  raise ImportError("zarr 3.0.0 or later is required to use the numcodecs zarr integration.")
44
46
  except ImportError as e: # pragma: no cover
45
47
  raise ImportError(
@@ -56,6 +58,23 @@ from zarr.core.common import JSON, parse_named_configuration, product
56
58
  CODEC_PREFIX = "numcodecs."
57
59
 
58
60
 
61
+ def _from_zarr_dtype(dtype: Any) -> np.dtype:
62
+ """
63
+ Get a numpy data type from an array spec, depending on the zarr version.
64
+ """
65
+ if Version(version('zarr')) >= Version("3.1.0"):
66
+ return dtype.to_native_dtype()
67
+ return dtype # pragma: no cover
68
+
69
+
70
+ def _to_zarr_dtype(dtype: np.dtype) -> Any:
71
+ if Version(version('zarr')) >= Version("3.1.0"):
72
+ from zarr.dtype import parse_data_type
73
+
74
+ return parse_data_type(dtype, zarr_format=3)
75
+ return dtype # pragma: no cover
76
+
77
+
59
78
  def _expect_name_prefix(codec_name: str) -> str:
60
79
  if not codec_name.startswith(CODEC_PREFIX):
61
80
  raise ValueError(
@@ -224,7 +243,8 @@ class LZMA(_NumcodecsBytesBytesCodec, codec_name="lzma"):
224
243
  class Shuffle(_NumcodecsBytesBytesCodec, codec_name="shuffle"):
225
244
  def evolve_from_array_spec(self, array_spec: ArraySpec) -> Shuffle:
226
245
  if self.codec_config.get("elementsize") is None:
227
- return Shuffle(**{**self.codec_config, "elementsize": array_spec.dtype.itemsize})
246
+ dtype = _from_zarr_dtype(array_spec.dtype)
247
+ return Shuffle(**{**self.codec_config, "elementsize": dtype.itemsize})
228
248
  return self # pragma: no cover
229
249
 
230
250
 
@@ -232,7 +252,8 @@ class Shuffle(_NumcodecsBytesBytesCodec, codec_name="shuffle"):
232
252
  class Delta(_NumcodecsArrayArrayCodec, codec_name="delta"):
233
253
  def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
234
254
  if astype := self.codec_config.get("astype"):
235
- return replace(chunk_spec, dtype=np.dtype(astype)) # type: ignore[call-overload]
255
+ dtype = _to_zarr_dtype(np.dtype(astype)) # type: ignore[call-overload]
256
+ return replace(chunk_spec, dtype=dtype)
236
257
  return chunk_spec
237
258
 
238
259
 
@@ -243,12 +264,14 @@ class BitRound(_NumcodecsArrayArrayCodec, codec_name="bitround"):
243
264
  class FixedScaleOffset(_NumcodecsArrayArrayCodec, codec_name="fixedscaleoffset"):
244
265
  def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
245
266
  if astype := self.codec_config.get("astype"):
246
- return replace(chunk_spec, dtype=np.dtype(astype)) # type: ignore[call-overload]
267
+ dtype = _to_zarr_dtype(np.dtype(astype)) # type: ignore[call-overload]
268
+ return replace(chunk_spec, dtype=dtype)
247
269
  return chunk_spec
248
270
 
249
271
  def evolve_from_array_spec(self, array_spec: ArraySpec) -> FixedScaleOffset:
250
272
  if self.codec_config.get("dtype") is None:
251
- return FixedScaleOffset(**{**self.codec_config, "dtype": str(array_spec.dtype)})
273
+ dtype = _from_zarr_dtype(array_spec.dtype)
274
+ return FixedScaleOffset(**{**self.codec_config, "dtype": str(dtype)})
252
275
  return self
253
276
 
254
277
 
@@ -258,7 +281,8 @@ class Quantize(_NumcodecsArrayArrayCodec, codec_name="quantize"):
258
281
 
259
282
  def evolve_from_array_spec(self, array_spec: ArraySpec) -> Quantize:
260
283
  if self.codec_config.get("dtype") is None:
261
- return Quantize(**{**self.codec_config, "dtype": str(array_spec.dtype)})
284
+ dtype = _from_zarr_dtype(array_spec.dtype)
285
+ return Quantize(**{**self.codec_config, "dtype": str(dtype)})
262
286
  return self
263
287
 
264
288
 
@@ -267,21 +291,27 @@ class PackBits(_NumcodecsArrayArrayCodec, codec_name="packbits"):
267
291
  return replace(
268
292
  chunk_spec,
269
293
  shape=(1 + math.ceil(product(chunk_spec.shape) / 8),),
270
- dtype=np.dtype("uint8"),
294
+ dtype=_to_zarr_dtype(np.dtype("uint8")),
271
295
  )
272
296
 
273
- def validate(self, *, dtype: np.dtype[Any], **_kwargs) -> None:
274
- if dtype != np.dtype("bool"):
297
+ # todo: remove this type: ignore when this class can be defined w.r.t.
298
+ # a single zarr dtype API
299
+ def validate(self, *, dtype: np.dtype[Any], **_kwargs) -> None: # type: ignore[override]
300
+ _dtype = _from_zarr_dtype(dtype)
301
+ if _dtype != np.dtype("bool"):
275
302
  raise ValueError(f"Packbits filter requires bool dtype. Got {dtype}.")
276
303
 
277
304
 
278
305
  class AsType(_NumcodecsArrayArrayCodec, codec_name="astype"):
279
306
  def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
280
- return replace(chunk_spec, dtype=np.dtype(self.codec_config["encode_dtype"])) # type: ignore[arg-type]
307
+ dtype = _to_zarr_dtype(np.dtype(self.codec_config["encode_dtype"])) # type: ignore[arg-type]
308
+ return replace(chunk_spec, dtype=dtype)
281
309
 
282
310
  def evolve_from_array_spec(self, array_spec: ArraySpec) -> AsType:
283
311
  if self.codec_config.get("decode_dtype") is None:
284
- return AsType(**{**self.codec_config, "decode_dtype": str(array_spec.dtype)})
312
+ # TODO: remove these coverage exemptions the correct way, i.e. with tests
313
+ dtype = _from_zarr_dtype(array_spec.dtype) # pragma: no cover
314
+ return AsType(**{**self.codec_config, "decode_dtype": str(dtype)}) # pragma: no cover
285
315
  return self
286
316
 
287
317
 
numcodecs/zfpy.py CHANGED
@@ -2,9 +2,8 @@ import warnings
2
2
  from contextlib import suppress
3
3
  from importlib.metadata import PackageNotFoundError, version
4
4
  from types import ModuleType
5
- from typing import Optional
6
5
 
7
- _zfpy: Optional[ModuleType] = None
6
+ _zfpy: ModuleType | None = None
8
7
 
9
8
  _zfpy_version: tuple = ()
10
9
  with suppress(PackageNotFoundError):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numcodecs
3
- Version: 0.16.1
3
+ Version: 0.16.2
4
4
  Summary: A Python package providing buffer compression and transformation codecs for use in data storage and communication applications.
5
5
  Maintainer-email: Alistair Miles <alimanfoo@googlemail.com>
6
6
  License-Expression: MIT
@@ -39,6 +39,7 @@ Provides-Extra: test
39
39
  Requires-Dist: coverage; extra == "test"
40
40
  Requires-Dist: pytest; extra == "test"
41
41
  Requires-Dist: pytest-cov; extra == "test"
42
+ Requires-Dist: pyzstd; extra == "test"
42
43
  Provides-Extra: test-extras
43
44
  Requires-Dist: importlib_metadata; extra == "test-extras"
44
45
  Provides-Extra: msgpack
@@ -1,24 +1,24 @@
1
1
  numcodecs/__init__.py,sha256=cgA3s5JGgVs9lAu6olFajOWgHpsCYtnLih10kMBBxS0,3104
2
- numcodecs/_shuffle.cpython-312-aarch64-linux-gnu.so,sha256=z6f6ous4uEpcvLMWxh-XXvW6yoN21z4Gkoo6igjVCx8,1425296
3
- numcodecs/abc.py,sha256=13vRquZ-u_n1YqM9SYx8sBDseJlH9A_A57_Z2QE-4KY,4504
2
+ numcodecs/_shuffle.cpython-312-aarch64-linux-gnu.so,sha256=FE-2eenpE_t1S1CDYdXdHBjU1ezOSQXnD0fdi_eldS4,1425296
3
+ numcodecs/abc.py,sha256=HGQVq7pPTByqylBqjbLhhDVE71OIAzMOfWnQ1MSTO2s,4473
4
4
  numcodecs/astype.py,sha256=pfdFqjNvb-PETswa2_UxZm632O-y2Lex-g_68IJpiuk,2099
5
5
  numcodecs/base64.py,sha256=79BSqVvloKc8JYenUQfqdPm0a0JAZhd9Zld7k5Cp2lc,752
6
6
  numcodecs/bitround.py,sha256=4lei39ZG4G2GGkDxl12q29nR5_8a4Icx4T-OgP1A1D4,2845
7
- numcodecs/blosc.cpython-312-aarch64-linux-gnu.so,sha256=MG-GL1XW8gP_X3PCH5YZYs0CWVACpg2UNIQ6WtPjwwA,13365600
7
+ numcodecs/blosc.cpython-312-aarch64-linux-gnu.so,sha256=RNXvpZJWMWExgSG3NrNRoe1-MWJ3tloHkwI70uUjknM,13365408
8
8
  numcodecs/bz2.py,sha256=4Ups3IMVsjvBlXyaeYONPdE14TaK9V-4LH5LSNe7AGc,1174
9
9
  numcodecs/categorize.py,sha256=jPipT6mVrpGSe9QuI-MeVzTZuUKAZWF0XN5Wj_8Ifng,2948
10
- numcodecs/checksum32.py,sha256=KoaT9cwXE-JEdwjEi6v5CM8HDgRcdqPm-G6IwEp45Po,5726
10
+ numcodecs/checksum32.py,sha256=zQv20v5CFCRtB3Kk0LiJ5zfgeWkJW6HZ21Lp7cMw22Y,5713
11
11
  numcodecs/compat.py,sha256=JadagE6pTEcrX3V8wDml0n1tdkHvOWo6D21J3a4P0mw,6505
12
- numcodecs/compat_ext.cpython-312-aarch64-linux-gnu.so,sha256=BzJP57UUZ-K0jmAoWKNX8ZapObRHNOf8hpCylPxLR_s,180272
12
+ numcodecs/compat_ext.cpython-312-aarch64-linux-gnu.so,sha256=1dZOZ7o1tdNCyJfZDsXdoWVPXyTvmU0pNseoKlqV25I,180264
13
13
  numcodecs/delta.py,sha256=x0PjNiuX48rmh9M6ZHoYkI9bKOq00Aiyz_jLrVlAq8w,2791
14
14
  numcodecs/errors.py,sha256=IV0B9fw_Wn8k3fjLtXOOU_-0_Al-dWY_dizvqFiNwkk,663
15
15
  numcodecs/fixedscaleoffset.py,sha256=fQwP_H-P3Mq4_LXtMQw5CLYeMjCBUdTtV-AKWVAIzkY,4188
16
- numcodecs/fletcher32.cpython-312-aarch64-linux-gnu.so,sha256=YEhEfZydQTiP0E6vX6KrLqrH8L0Fk1DiBnZlh9jyIRs,1633152
16
+ numcodecs/fletcher32.cpython-312-aarch64-linux-gnu.so,sha256=PZVIiKGFVRz19gICKLPlk1wFqvitaZIoOOko6i-yPgI,1634712
17
17
  numcodecs/gzip.py,sha256=DJuc87g8neqn-SYEeCEQwPSdEN5oZGgDUan9MTI6Fb4,1436
18
- numcodecs/jenkins.cpython-312-aarch64-linux-gnu.so,sha256=y8VbS9tqw3PcF7-yt2XqiOWBjRZjoPyM9mhCV5h_QPg,1553056
18
+ numcodecs/jenkins.cpython-312-aarch64-linux-gnu.so,sha256=BSlJ9o3dQrOf06x_KGvITfVTAZ7r-XDVWM8o1M3VOvY,1555384
19
19
  numcodecs/json.py,sha256=WQcDcDPVxAQm-sxUg_XD70InKLD4iyjQOBiHPn2N3VE,3393
20
- numcodecs/lz4.cpython-312-aarch64-linux-gnu.so,sha256=SuGXtTavpZx3o5GAtWk7CXW01-ET1Su-w5_OPHNVL7I,2561712
21
- numcodecs/lzma.py,sha256=6XeJ-c-lTJN1EVrIOb5cEFEiMGlNHsS4c_OentmUox0,2257
20
+ numcodecs/lz4.cpython-312-aarch64-linux-gnu.so,sha256=coUREfXIjXc-R_8NMdzRa0t2oq2l9fYfC_BpPanGr68,2562904
21
+ numcodecs/lzma.py,sha256=AsIzH_VkKs6Uj3xoP908j82pdTugxiX3MjaRiqWQw8k,2226
22
22
  numcodecs/msgpacks.py,sha256=GkTcFJrhKdpWnwQn4-282q4_edqlzZFdJFux2LtNk30,2619
23
23
  numcodecs/ndarray_like.py,sha256=fVupUg_K_rDZNRlUmTiRp53OmF6YHb-yNyixJNFR8ME,1883
24
24
  numcodecs/packbits.py,sha256=L7gM-8AQQTPC2IOPbatzNp-tH67EUp0Tonx_JSYHje4,1993
@@ -27,12 +27,12 @@ numcodecs/pickles.py,sha256=LtcMa6cK-V5TUYJNR4dRDsWWRmLfNv0syZddbrbRv3A,1290
27
27
  numcodecs/quantize.py,sha256=4mPx4kWanv5wGa22HvEiP893xqG5dDDtN-oKChj6nfE,3016
28
28
  numcodecs/registry.py,sha256=oRN9uJsWIosZbAZFkOWyUos3GZ-h_zq_cN-t_uPLk0A,1864
29
29
  numcodecs/shuffle.py,sha256=hYOFJOCEeDSNI-TqT1JrbQxbprkQD4R8VfSzD4IPI3I,1575
30
- numcodecs/version.py,sha256=F9gYFcoy3pBKCGHGvpyLTi-COcjAERgGjmHEmYnZSSQ,513
31
- numcodecs/vlen.cpython-312-aarch64-linux-gnu.so,sha256=LmEHxFLTbcTsSmzt7TwKGi-Q6ol7bwXHbcJLO8P-Dhg,2170960
32
- numcodecs/zarr3.py,sha256=4OxPvdvqlUTek07Uvw1-wo_0wZz_7EaGZuSwmapZtjg,11889
33
- numcodecs/zfpy.py,sha256=--TCrXOsSJ-2uU_7d-0YwHpk8Hti98hofB4jht5helk,3900
30
+ numcodecs/version.py,sha256=ypwallA3PYa0X5lB0jSGkU5P26m2Z-w7iRiaWdnAP9g,513
31
+ numcodecs/vlen.cpython-312-aarch64-linux-gnu.so,sha256=xzvYe5KsFP0soYbbGYDiPYPFnmBtGS2VZCt72RLKqEc,2172632
32
+ numcodecs/zarr3.py,sha256=fcLc0w3YSxujquhvdABOoc0Z0QfO2rK8BwSLH0MFisM,13117
33
+ numcodecs/zfpy.py,sha256=2GRLkDnDQf_VbxXYn34MQTYVZfrsTuGR4-_vWdpya00,3869
34
34
  numcodecs/zlib.py,sha256=gLPUICEQc5p6DICC_63nOsbUqxzJH_5ynuzenTQXzOQ,1049
35
- numcodecs/zstd.cpython-312-aarch64-linux-gnu.so,sha256=sFaRH_cNWn-wD0iiKlsFjyoDd8QNtxGNDOQpEs12Kto,10603096
35
+ numcodecs/zstd.cpython-312-aarch64-linux-gnu.so,sha256=dtOKnalKt3F4m8tHkJi5fMsvZOSuy_gA7_xLHzimTC0,10661824
36
36
  numcodecs/tests/__init__.py,sha256=Q6sNFjGUjcEU3MvCUd-PDtmYcS79Yvys3wbWWXvU5qY,72
37
37
  numcodecs/tests/common.py,sha256=_aRsy2opNa4t4byfvsUgMe4lxH_Oua125tfQWR1gBgI,9307
38
38
  numcodecs/tests/test_astype.py,sha256=Wu1HtHZA6K_rW-JCxSWmU4Wwp9U83JUbUZ2ro9xDk9s,2367
@@ -58,30 +58,31 @@ numcodecs/tests/test_ndarray_like.py,sha256=Bh8wDqkbSL-yr_MDQqE5XUoWzZav5J_VzC8L
58
58
  numcodecs/tests/test_packbits.py,sha256=8B2sQnM-DiAEtehCEm5xm7fQ1xWm0rMk_z7Uk8OXvGI,989
59
59
  numcodecs/tests/test_pcodec.py,sha256=2ntYLBGaEJrztEoRlnkE38ObYpmQf6l1wwH_Z2pYqwk,2500
60
60
  numcodecs/tests/test_pickles.py,sha256=p7LfH5qJp1mmJC0nRWJbyPVCvt46raS_A6pjOZYOXqY,1679
61
+ numcodecs/tests/test_pyzstd.py,sha256=NQRPeMw_TqLK91faoedBfe2rvCB79cfNj4e9cwiYmnU,2614
61
62
  numcodecs/tests/test_quantize.py,sha256=KvOyoj-u4S_-z8pT4syR6yE4i1ftFGkRfCTmgafumGw,2151
62
63
  numcodecs/tests/test_registry.py,sha256=9Wp-VxGtEtNvwj46Edv6R8Jc4WPu80yWP7mRZyxepJ4,1116
63
64
  numcodecs/tests/test_shuffle.py,sha256=uFWTuBbdcqwnWbyh2knwc46klZ00VekzWh8Ya0I2HiE,4659
64
65
  numcodecs/tests/test_vlen_array.py,sha256=QaWVuflGxQUFToVcWVIzZHG_b8Vm4JJG6mBZVGNasK0,2477
65
66
  numcodecs/tests/test_vlen_bytes.py,sha256=BpASj3-ap_ZjyK_nYP7YQSZg4gsECCh5DW_4pdNlhRs,2473
66
67
  numcodecs/tests/test_vlen_utf8.py,sha256=H92YtqNY0kpO2Icu1Ey2iItK38ZhKMnJi_2FBwcKSvU,2474
67
- numcodecs/tests/test_zarr3.py,sha256=LbE8gWkH7tSMMaHPJiBb06sD-g_Xtd0_e-CfpuZTgCE,9414
68
+ numcodecs/tests/test_zarr3.py,sha256=2d8P6iuJql3lmCVIcCKUQ-lKh7I2ahUNbk44Vy9-zRc,9366
68
69
  numcodecs/tests/test_zarr3_import.py,sha256=JBDyrL57lbZMI9axb9eA1OZnd_Lg-ppfsNV3VvxwVxk,332
69
70
  numcodecs/tests/test_zfpy.py,sha256=g_2txraHDbnBPtbymJXsgAiD6MBH44-JYRkNx9tttYw,2762
70
71
  numcodecs/tests/test_zlib.py,sha256=TFa-I15xHd4h2nNC2goChWdlB_xZLbK_vAL7s4upPWI,2539
71
- numcodecs/tests/test_zstd.py,sha256=79R6VMhni-6kg9LmlmBzGe22HXhg0RvSVjw4jVNPMJQ,2610
72
+ numcodecs/tests/test_zstd.py,sha256=yca-1BY9kh82ini_gabj5THf3udeUhwxnzW23ZN4xBA,5610
72
73
  numcodecs/tests/package_with_entrypoint/__init__.py,sha256=wLyrk73nqKO8rcFtA_sXlcC8PKMzdYbbBRY8eH8Xc10,212
73
74
  numcodecs/tests/package_with_entrypoint-0.1.dist-info/entry_points.txt,sha256=wel2k9KStuNez__clm2tjAwrcXiP17De8yNScHYtQZU,60
74
- numcodecs-0.16.1.dist-info/METADATA,sha256=naRVJ5q6M8hV2cfBpfg_ecAsXyiHKDWBjvrUC8IAi94,3251
75
- numcodecs-0.16.1.dist-info/WHEEL,sha256=J-CZBQEyjku8f7IzJXgy8J-ooOLhO1ZP525IpLQTpYc,153
76
- numcodecs-0.16.1.dist-info/entry_points.txt,sha256=3W3FHKrwE52X3fLq8KdioOtf93lh5KaoGV5t2D10DBI,919
77
- numcodecs-0.16.1.dist-info/top_level.txt,sha256=JkHllzt6IuVudg4Tk--wF-yfPPsdVOiMTag1tjGIihw,10
78
- numcodecs-0.16.1.dist-info/RECORD,,
79
- numcodecs-0.16.1.dist-info/licenses/LICENSE.txt,sha256=lJysaEeeE7bJeSRjUVC04e9eaXZq2eRy6oWgjBV2u5Y,1124
80
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSE.txt,sha256=ImIxMam59qhqTca5vMux0q6zkN-GvKAPxyevJHNcL64,1644
81
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSES/BITSHUFFLE.txt,sha256=7zV8IGHPZ9spj58VZVcu4imtkmNYKp-dDr_1CU9dEKw,1148
82
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSES/FASTLZ.txt,sha256=z1KQnm7XcP6BURumLU6-4TGF0wo30P194rVmheKIqzg,1135
83
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSES/LZ4.txt,sha256=_m3B8n9o2d1rAZLjm-Go8fvtD-huE1QPYYpxM5cbELM,1312
84
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSES/SNAPPY.txt,sha256=UiGjaoAbmB-9_ae4fbZM_yMaO4giOgZsMlQRtTnfeW8,1475
85
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSES/STDINT.txt,sha256=8q8D21YuiFOfAZsasIgYeO6C0MgPO85oxlAGRlLiXXs,1568
86
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSES/ZLIB-NG.txt,sha256=-K03V7wq6fWmr3fhOzelchOXQhzlWrFuHaSeRikmTSw,893
87
- numcodecs-0.16.1.dist-info/licenses/c-blosc/LICENSES/ZLIB.txt,sha256=hF78d4V9SF2R-z4LiEqqkpNoxxeugYa2b-HtJJV1MkM,1002
75
+ numcodecs-0.16.2.dist-info/METADATA,sha256=cyWrDyPJ7I1bwRDkNHGz2pTcVj70KhsfM6VW0u2kJE4,3290
76
+ numcodecs-0.16.2.dist-info/WHEEL,sha256=29GglsfgOKni3MnvXwDNoeBjBZY4LOjl_HH3QTWETk4,153
77
+ numcodecs-0.16.2.dist-info/entry_points.txt,sha256=3W3FHKrwE52X3fLq8KdioOtf93lh5KaoGV5t2D10DBI,919
78
+ numcodecs-0.16.2.dist-info/top_level.txt,sha256=JkHllzt6IuVudg4Tk--wF-yfPPsdVOiMTag1tjGIihw,10
79
+ numcodecs-0.16.2.dist-info/RECORD,,
80
+ numcodecs-0.16.2.dist-info/licenses/LICENSE.txt,sha256=lJysaEeeE7bJeSRjUVC04e9eaXZq2eRy6oWgjBV2u5Y,1124
81
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSE.txt,sha256=ImIxMam59qhqTca5vMux0q6zkN-GvKAPxyevJHNcL64,1644
82
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSES/BITSHUFFLE.txt,sha256=7zV8IGHPZ9spj58VZVcu4imtkmNYKp-dDr_1CU9dEKw,1148
83
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSES/FASTLZ.txt,sha256=z1KQnm7XcP6BURumLU6-4TGF0wo30P194rVmheKIqzg,1135
84
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSES/LZ4.txt,sha256=_m3B8n9o2d1rAZLjm-Go8fvtD-huE1QPYYpxM5cbELM,1312
85
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSES/SNAPPY.txt,sha256=UiGjaoAbmB-9_ae4fbZM_yMaO4giOgZsMlQRtTnfeW8,1475
86
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSES/STDINT.txt,sha256=8q8D21YuiFOfAZsasIgYeO6C0MgPO85oxlAGRlLiXXs,1568
87
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSES/ZLIB-NG.txt,sha256=-K03V7wq6fWmr3fhOzelchOXQhzlWrFuHaSeRikmTSw,893
88
+ numcodecs-0.16.2.dist-info/licenses/c-blosc/LICENSES/ZLIB.txt,sha256=hF78d4V9SF2R-z4LiEqqkpNoxxeugYa2b-HtJJV1MkM,1002
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp312-cp312-manylinux_2_17_aarch64
5
5
  Tag: cp312-cp312-manylinux2014_aarch64