Skip to content

Commit 046f984

Browse files
authored
Merge branch 'main' into fix_pcodec_soft
2 parents a4e1bb6 + d8d53bb commit 046f984

28 files changed

+237
-239
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,89 +16,55 @@ jobs:
1616
# macos-13 is an intel runner, macos-14 is a arm64 runner
1717
platform: [ubuntu-latest, windows-latest, macos-13, macos-14]
1818

19+
defaults:
20+
run:
21+
shell: bash -el {0}
22+
1923
steps:
2024
- name: Checkout source
2125
uses: actions/checkout@v4
2226
with:
2327
submodules: recursive
28+
fetch-depth: 0 # required for version resolution
2429

2530
- name: Set up Conda
2631
uses: conda-incubator/[email protected]
2732
with:
28-
channels: conda-forge
29-
miniforge-version: latest
30-
python-version: ${{ matrix.python-version }}
33+
channels: conda-forge
34+
miniforge-version: latest
35+
python-version: ${{ matrix.python-version }}
3136

32-
- name: Show info about `base` environment
33-
shell: "bash -l {0}"
34-
run: |
35-
conda info
36-
conda config --show-sources
37-
conda list --show-channel-urls
38-
39-
- name: Set up `env`
40-
shell: "bash -l {0}"
41-
run: >
42-
conda create -n env
43-
c-compiler cxx-compiler
44-
python=${{matrix.python-version}} wheel pip
37+
- name: Install compilers
38+
run: conda install -y c-compiler cxx-compiler
4539

4640
- name: Install clang
47-
shell: "bash -l {0}"
4841
if: matrix.platform == 'macos-13'
49-
run: |
50-
conda activate env
51-
conda install -y 'clang>=12.0.1,<17'
42+
run: conda install -y 'clang>=12.0.1,<17'
5243

53-
- name: Show info about `env` environment
54-
shell: "bash -l {0}"
44+
- name: Show conda environment info
5545
run: |
56-
conda list --show-channel-urls -n env
46+
conda info
47+
conda config --show-sources
48+
conda list --show-channel-urls
5749
5850
- name: Install numcodecs
59-
shell: "bash -l {0}"
6051
run: |
61-
conda activate env
6252
export DISABLE_NUMCODECS_AVX2=""
63-
# TODO: put back zfpy import when it supports numpy 2.0
64-
python -m pip install -v -e .[test,test_extras,msgpack,crc32c]
65-
66-
- name: Install pcodec
67-
if: matrix.python-version != '3.13'
68-
shell: "bash -l {0}"
69-
run: |
70-
conda activate env
71-
python -m pip install -v ".[pcodec]"
53+
python -m pip install -v -e .[test,test_extras,msgpack,crc32c,pcodec,zfpy]
7254
7355
- name: Install zarr-python
74-
shell: "bash -l {0}"
7556
# Since zarr v3 requires numpy >= 1.25, on Python 3.11 leave it out
7657
# so we can have some tests of our minimum version of numpy (1.24)
7758
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>=3.0.0b2
82-
83-
# This is used to test with zfpy, which does not yet support numpy 2.0
84-
- name: Install older numpy and zfpy
85-
if: matrix.python-version == '3.11'
86-
shell: "bash -l {0}"
87-
run: |
88-
conda activate env
89-
python -m pip install -v ".[zfpy]"
59+
# TODO: remove --pre option when zarr v3 is out
60+
run: python -m pip install --pre zarr>=3.0.0b2
9061

9162
- name: List installed packages
92-
shell: "bash -l {0}"
93-
run: |
94-
conda activate env
95-
python -m pip list
63+
run: python -m pip list
9664

9765
- name: Run tests
9866
shell: "bash -l {0}"
99-
run: |
100-
conda activate env
101-
pytest -v
67+
run: pytest -v
10268

10369
- uses: codecov/codecov-action@v5
10470
with:

.pre-commit-config.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
exclude: ^fixture/ # files with trailing whitespaces on purpose
22
ci:
33
autoupdate_commit_msg: "chore: update pre-commit hooks"
4+
autoupdate_schedule: "monthly"
45
autofix_commit_msg: "style: pre-commit fixes"
56
autofix_prs: false
67
default_stages: [pre-commit, pre-push]
7-
default_language_version:
8-
python: python3
98
repos:
109
- repo: https://github.com/pre-commit/pre-commit-hooks
1110
rev: v5.0.0
@@ -15,7 +14,7 @@ repos:
1514
- id: debug-statements
1615

1716
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: v0.8.1
17+
rev: v0.8.4
1918
hooks:
2019
- id: ruff
2120
args: ["--fix", "--show-fixes"]
@@ -27,8 +26,8 @@ repos:
2726
- id: sp-repo-review
2827

2928
- repo: https://github.com/pre-commit/mirrors-mypy
30-
rev: 'v1.13.0'
29+
rev: v1.14.0
3130
hooks:
3231
- id: mypy
3332
args: [--config-file, pyproject.toml]
34-
additional_dependencies: [numpy, pytest, crc32c, zfpy, 'zarr>=3.0.0b2']
33+
additional_dependencies: [numpy, pytest, crc32c, zfpy, 'zarr>=3.0.0rc1']

adhoc/blosc_memleak_check.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import sys
22

3+
import numcodecs
34
import numpy as np
45
from numpy.testing import assert_array_equal
56

6-
import numcodecs
7-
87
codec = numcodecs.Blosc()
98
data = np.arange(int(sys.argv[1]))
109
for _ in range(int(sys.argv[2])):

docs/compression/blosc.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@ Blosc
1818
Helper functions
1919
----------------
2020

21-
.. autofunction:: init
22-
.. autofunction:: destroy
23-
.. autofunction:: compname_to_compcode
2421
.. autofunction:: list_compressors
2522
.. autofunction:: get_nthreads
2623
.. autofunction:: set_nthreads
27-
.. autofunction:: cbuffer_sizes
2824
.. autofunction:: cbuffer_complib
29-
.. autofunction:: cbuffer_metainfo
3025
.. autofunction:: compress
3126
.. autofunction:: decompress
32-
.. autofunction:: decompress_partial

docs/release.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ Breaking changes
2222
are now keyword only, to support the updated API.
2323
By :user:`Sam Levang <slevang>`, :issue:`623`
2424

25+
Deprecations
26+
~~~~~~~~~~~~
27+
The following ``blosc`` funcitons are deprecated, with no replacement.
28+
This is because they are not intended to be public API.
29+
30+
- ``numcodecs.blosc.init``
31+
- ``numcodecs.blosc.destroy``
32+
- ``numcodecs.blosc.compname_to_compcode``
33+
- ``numcodecs.blosc.cbuffer_sizes``
34+
- ``numcodecs.blosc.cbuffer_metainfo``
35+
36+
In addition, ``numcodecs.blosc.decompress_partial`` is deprecated as
37+
has always been experimental and there is no equivalent in the official
38+
blsoc Python package.
2539

2640
Fixes
2741
~~~~~
@@ -31,7 +45,13 @@ Fixes
3145
Previously importing ``numcodecs.pcodec`` would work if ``pcodec`` is not installed,
3246
but now it will fail to import. This mirrors the behaviour of other optional dependencies.
3347
By :user:`John Kirkham <jakirkham>`, :issue:`647`
48+
* Fixes issues with the upcoming ``zarr`` 3.0.0 release.
49+
By :user:`Norman Rzepka <normanrz>`, :issue:`675`
3450

51+
* Removed Version Check: The previous code included a check for the `NumPy` version
52+
and a warning if the version was incompatible with `zfpy`.
53+
This check has been removed because `zfpy` now supports the newer versions of `NumPy`.
54+
By :user:`Meher Gajula <me-her>`, :issue:`672`
3555

3656
Improvements
3757
~~~~~~~~~~~~

docs/zarr3.rst

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Zarr 3 codecs
55
.. automodule:: numcodecs.zarr3
66

77

8-
Bytes-to-bytes codecs
9-
---------------------
8+
Compressors (bytes-to-bytes codecs)
9+
-----------------------------------
1010
.. autoclass:: Blosc()
1111

1212
.. autoattribute:: codec_name
@@ -40,58 +40,61 @@ Bytes-to-bytes codecs
4040
.. autoattribute:: codec_name
4141

4242

43-
Array-to-array codecs
44-
---------------------
45-
.. autoclass:: Delta()
43+
Checksum codecs (bytes-to-bytes codecs)
44+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45+
Need to be used as ``compressors`` in zarr-python.
46+
47+
.. autoclass:: CRC32()
4648

4749
.. autoattribute:: codec_name
4850

49-
.. autoclass:: BitRound()
51+
.. autoclass:: CRC32C()
5052

5153
.. autoattribute:: codec_name
5254

53-
.. autoclass:: FixedScaleOffset()
55+
.. autoclass:: Adler32()
5456

5557
.. autoattribute:: codec_name
5658

57-
.. autoclass:: Quantize()
59+
.. autoclass:: Fletcher32()
5860

5961
.. autoattribute:: codec_name
6062

61-
.. autoclass:: PackBits()
63+
.. autoclass:: JenkinsLookup3()
6264

6365
.. autoattribute:: codec_name
6466

65-
.. autoclass:: AsType()
6667

67-
.. autoattribute:: codec_name
68+
Filters (array-to-array codecs)
69+
-------------------------------
70+
.. autoclass:: Delta()
6871

72+
.. autoattribute:: codec_name
6973

70-
Bytes-to-bytes checksum codecs
71-
------------------------------
72-
.. autoclass:: CRC32()
74+
.. autoclass:: BitRound()
7375

7476
.. autoattribute:: codec_name
7577

76-
.. autoclass:: CRC32C()
78+
.. autoclass:: FixedScaleOffset()
7779

7880
.. autoattribute:: codec_name
7981

80-
.. autoclass:: Adler32()
82+
.. autoclass:: Quantize()
8183

8284
.. autoattribute:: codec_name
8385

84-
.. autoclass:: Fletcher32()
86+
.. autoclass:: PackBits()
8587

8688
.. autoattribute:: codec_name
8789

88-
.. autoclass:: JenkinsLookup3()
90+
.. autoclass:: AsType()
8991

9092
.. autoattribute:: codec_name
9193

9294

93-
Array-to-bytes codecs
94-
---------------------
95+
96+
Serializers (array-to-bytes codecs)
97+
-----------------------------------
9598
.. autoclass:: PCodec()
9699

97100
.. autoattribute:: codec_name

notebooks/benchmark_vlen.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
}
2525
],
2626
"source": [
27-
"import numpy as np\n",
28-
"\n",
2927
"import numcodecs\n",
28+
"import numpy as np\n",
3029
"\n",
3130
"numcodecs.__version__"
3231
]

numcodecs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
ncores = multiprocessing.cpu_count()
5050
except OSError: # pragma: no cover
5151
ncores = 1
52-
blosc.init()
52+
blosc._init()
5353
blosc.set_nthreads(min(8, ncores))
5454
atexit.register(blosc.destroy)
5555

numcodecs/astype.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ def encode(self, buf):
4949
arr = ensure_ndarray(buf).view(self.decode_dtype)
5050

5151
# convert and copy
52-
enc = arr.astype(self.encode_dtype)
53-
54-
return enc
52+
return arr.astype(self.encode_dtype)
5553

5654
def decode(self, buf, out=None):
5755
# normalise input
@@ -61,9 +59,7 @@ def decode(self, buf, out=None):
6159
dec = enc.astype(self.decode_dtype)
6260

6361
# handle output
64-
out = ndarray_copy(dec, out)
65-
66-
return out
62+
return ndarray_copy(dec, out)
6763

6864
def get_config(self):
6965
return {

numcodecs/base64.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ def encode(self, buf):
1313
# normalise inputs
1414
buf = ensure_contiguous_ndarray(buf)
1515
# do compression
16-
compressed = _base64.standard_b64encode(buf)
17-
return compressed
16+
return _base64.standard_b64encode(buf)
1817

1918
def decode(self, buf, out=None):
2019
# normalise inputs

0 commit comments

Comments
 (0)