Skip to content

Commit 9c05ebc

Browse files
committed
Merge branch 'transpose' of github.com:ricardosp4/python-blosc2 into transpose
2 parents 5317a80 + 255bb1b commit 9c05ebc

35 files changed

+1804
-26587
lines changed

.github/workflows/cibuildwheels.yml

Lines changed: 54 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,50 @@ env:
1414
# Skip testing on aarch64 for now, as it is emulated on GitHub Actions and takes too long
1515
# Now that github provides native arm64 runners, we can enable tests again
1616
# CIBW_TEST_SKIP: "*linux*aarch64*"
17+
# Skip PyPy wheels for now (numexpr needs some adjustments first)
18+
# musllinux takes too long to build, and it's not worth it for now
19+
CIBW_SKIP: "pp* *musllinux* *-win32"
1720

1821
jobs:
1922

2023
build_wheels:
21-
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }} - ${{ matrix.p_ver }}
22-
runs-on: ${{ matrix.os }}
24+
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
25+
runs-on: ${{ matrix.runs-on || matrix.os }}
2326
permissions:
2427
contents: write
2528
env:
2629
CIBW_BUILD: ${{ matrix.cibw_build }}
2730
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
2831
CIBW_ARCHS_MACOS: "x86_64 arm64"
2932
strategy:
33+
fail-fast: false
3034
matrix:
31-
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest]
32-
arch: [x86_64, aarch64]
33-
# aarch64 is emulated, and it is giving issues with cibuildwheel
34-
# Just build for x86_64 for now (Mac arm64 is already covered by cibuildwheel)
35-
# arch: [x86_64]
36-
cibw_build: ["cp3{11,12,13}-*"]
37-
p_ver: ["3.11-3.13"]
38-
exclude:
39-
- os: windows-latest
40-
arch: aarch64
41-
# cibuild is already in charge to build aarch64 (see CIBW_ARCHS_MACOS)
42-
- os: macos-latest
43-
arch: aarch64
44-
# Mutually exclude aarch64 and x86_64 for ubuntu-24.04-arm and ubuntu-latest
45-
- os: ubuntu-24.04-arm
46-
arch: x86_64
35+
include:
36+
# Linux x86_64 builds
4737
- os: ubuntu-latest
38+
arch: x86_64
39+
cibw_pattern: "cp3{11,12,13}-manylinux*"
40+
artifact_name: "linux-x86_64"
41+
42+
# Linux ARM64 builds (native runners)
43+
- os: ubuntu-24.04-arm
4844
arch: aarch64
45+
cibw_pattern: "cp3{11,12,13}-manylinux*"
46+
artifact_name: "linux-aarch64"
47+
# Don't use native runners for now (looks like wait times are too long)
48+
#runs-on: ["ubuntu-latest", "arm64"]
49+
50+
# Windows builds
51+
- os: windows-latest
52+
arch: x86_64
53+
cibw_pattern: "cp3{11,12,13}-win64"
54+
artifact_name: "windows-x86_64"
4955

56+
# macOS builds (universal2)
57+
- os: macos-latest
58+
arch: x86_64
59+
cibw_pattern: "cp3{11,12,13}-macosx*"
60+
artifact_name: "macos-universal2"
5061
steps:
5162
- name: Checkout repo
5263
uses: actions/checkout@v4
@@ -58,9 +69,9 @@ jobs:
5869
python-version: '3.x'
5970

6071
# For some reason, this is still needed, even when using new arm64 runners
61-
- name: Set up QEMU
62-
if: ${{ matrix.arch == 'aarch64' }}
63-
uses: docker/setup-qemu-action@v3
72+
# - name: Set up QEMU
73+
# if: ${{ matrix.arch == 'aarch64' }}
74+
# uses: docker/setup-qemu-action@v3
6475

6576
- name: Install Ninja
6677
id: ninja
@@ -74,68 +85,52 @@ jobs:
7485
- name: Build wheels
7586
uses: pypa/[email protected]
7687

77-
- name: Upload wheels
78-
uses: actions/upload-artifact@v4
79-
with:
80-
name: wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.p_ver }}
81-
path: ./wheelhouse/*.whl
82-
83-
build_sdist:
84-
name: Build sdist
85-
runs-on: ubuntu-latest
86-
strategy:
87-
matrix:
88-
python-version: [3.12]
89-
os: [ubuntu-latest]
90-
arch: [auto]
91-
exclude:
92-
- os: [ubuntu-latest]
93-
# We don't support 32-bit platforms in python-blosc2
94-
arch: x86
95-
96-
steps:
97-
- uses: actions/checkout@v4
98-
99-
- uses: actions/setup-python@v5
100-
name: Setup Python ${{ matrix.python-version }}
101-
with:
102-
python-version: ${{ matrix.python-version }}
103-
104-
- name: Build sdist
105-
run: pipx run build --sdist --outdir ./wheelhouse
106-
107-
- name: Upload sdist package
108-
uses: actions/upload-artifact@v4
109-
with:
110-
name: wheels-source
111-
path: wheelhouse/*.tar.gz
88+
- name: Make sdist
89+
if: ${{ matrix.os == 'ubuntu-latest' }}
90+
run: |
91+
python -m pip install build
92+
python -m build --sdist --outdir wheelhouse .
11293
11394
- name: Build building extension from sdist package
95+
if: ${{ matrix.os == 'ubuntu-latest' }}
11496
run: |
11597
cd ./wheelhouse
11698
tar -xzf blosc2-*.tar.gz
11799
cd ./blosc2-*/
100+
python -m venv sdist_test_env
101+
source sdist_test_env/bin/activate
118102
pip install pip --upgrade
119103
pip install --break-system-packages -e .[test]
120104
121105
- name: Test sdist package with pytest
106+
if: ${{ matrix.os == 'ubuntu-latest' }}
107+
timeout-minutes: 10
122108
run: |
123109
cd ./wheelhouse/blosc2-*/
124-
pytest
110+
source sdist_test_env/bin/activate
111+
python -m pytest tests/test_open.py tests/test_vlmeta.py tests/ndarray/test_evaluate.py
112+
113+
- uses: actions/upload-artifact@v4
114+
with:
115+
name: ${{ matrix.artifact_name }}
116+
path: |
117+
./wheelhouse/*.whl
118+
./wheelhouse/*.tar.gz
119+
125120
126121
upload_pypi:
127-
needs: [ build_wheels, build_sdist ] # last but not least
122+
needs: [ build_wheels]
128123
runs-on: ubuntu-latest
129124
# Only upload wheels when tagging (typically a release)
130125
if: startsWith(github.event.ref, 'refs/tags')
131126
steps:
132127
- uses: actions/download-artifact@v4
133128
with:
134-
name: wheels-*
135129
path: ./wheelhouse
136130
merge-multiple: true # Merge all the wheels artifacts into one directory
137131

138132
- uses: pypa/gh-action-pypi-publish@release/v1
139133
with:
140134
user: __token__
141135
password: ${{ secrets.blosc_pypi_secret }}
136+
packages-dir: wheelhouse/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
- id: trailing-whitespace
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.9.4
19+
rev: v0.11.4
2020
hooks:
2121
- id: ruff
2222
args: ["--fix", "--show-fixes"]

ANNOUNCE.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
Announcing Python-Blosc2 3.2.0
1+
Announcing Python-Blosc2 3.2.1
22
==============================
33

4-
This is a minor release where we fixed some bugs related with the
5-
maximum type size supported by Blosc2; now, the maximum size is
6-
512 MB (compared to 255 bytes in previous versions). We are also
7-
introducing WASM32 wheels for the first time.
4+
Here, all array containers in Blosc2 implement the ``__array_interface__``
5+
protocol to expose the data in the array. This allows for better
6+
interoperability with other libraries like NumPy, CuPy, etc. Now, the range
7+
of functions spans to most of NumPy functions, including reductions.
88

9-
We also added new ``blosc2.matmul()`` function for computing matrix
10-
multiplication on NDArray instances.
9+
See examples at: https://github.com/Blosc/python-blosc2/blob/main/examples/ndarray/jit-numpy-funcs.py
10+
See benchmarks at: https://github.com/Blosc/python-blosc2/blob/main/bench/ndarray/jit-numpy-funcs.py
11+
12+
We have also improved the performance of constructors like ``blosc2.linspace()``
13+
or ``blosc2.arange()`` by a factor of up to 3x for large arrays.
1114

1215
You can think of Python-Blosc2 3.x as an extension of NumPy/numexpr that:
1316

@@ -17,7 +20,6 @@ You can think of Python-Blosc2 3.x as an extension of NumPy/numexpr that:
1720
- Supports NumPy ufunc mechanism: mix and match NumPy and Blosc2 computations.
1821
- Integrates with Numba and Cython via UDFs (User Defined Functions).
1922
- Adheres to modern NumPy casting rules way better than numexpr.
20-
- Computes expressions only when needed. They can also be stored for later use.
2123
- Supports linear algebra operations (like ``blosc2.matmul()``).
2224

2325
Install it with::

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ else()
5050
include(FetchContent)
5151
FetchContent_Declare(blosc2
5252
GIT_REPOSITORY https://github.com/Blosc/c-blosc2
53-
GIT_TAG 55a103239b24f8b4e07dafa5a289ad62bfade524 # v2.17.0
53+
GIT_TAG 5fcd6fbf9ffcf613fabdb1eb3a90eeb12f7c04fe # v2.17.1
5454
)
5555
FetchContent_MakeAvailable(blosc2)
5656
include_directories("${blosc2_SOURCE_DIR}/include")

README.rst

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,31 @@ A fast & compressed ndarray library with a flexible compute engine
2323
:target: https://github.com/Blosc/python-blosc2/actions/workflows/build.yml
2424

2525

26-
What it is
27-
==========
26+
What is Python-Blosc2?
27+
=======================
2828

2929
Python-Blosc2 is a high-performance compressed ndarray library with a flexible
30-
compute engine. It uses the C-Blosc2 library as the compression backend.
31-
`C-Blosc2 <https://github.com/Blosc/c-blosc2>`_ is the next generation of
32-
Blosc, an `award-winning <https://www.blosc.org/posts/prize-push-Blosc2/>`_
33-
library that has been around for more than a decade, and that is been used
34-
by many projects, including `PyTables <https://www.pytables.org/>`_ or
35-
`Zarr <https://zarr.readthedocs.io/en/stable/>`_.
36-
37-
Python-Blosc2 is Python wrapper that exposes the C-Blosc2 API, *plus* an
38-
integrated compute engine. This allows to perform complex calculations on
39-
compressed data in a way that operands do not need to be in-memory, but can be
40-
stored on disk or on `the network <https://github.com/ironArray/Caterva2>`_.
41-
This makes possible to work with data no matter how large it is, and that
42-
can be stored in a distributed fashion.
43-
44-
Most importantly, Python-Blosc2 uses the `C-Blosc2 simple and open format
30+
compute engine, using `C-Blosc2 <https://www.blosc.org/c-blosc2/c-blosc2.html>`_
31+
as its compression backend. It allows complex calculations on compressed data,
32+
whether stored in memory, on disk, or over the network (e.g., via
33+
`Caterva2 <https://github.com/ironArray/Caterva2>`_). It uses the
34+
`C-Blosc2 simple and open format
4535
<https://github.com/Blosc/c-blosc2/blob/main/README_FORMAT.rst>`_ for storing
46-
compressed data, making it easy to integrate with other systems and tools.
47-
48-
You can find more introductory info about Python-Blosc2 at:
36+
compressed data.
4937

50-
https://www.blosc.org/python-blosc2/getting_started/overview.html
38+
More info: https://www.blosc.org/python-blosc2/getting_started/overview.html
5139

5240
Installing
5341
==========
5442

55-
Blosc2 now provides Python wheels for the major OS (Win, Mac and Linux) and platforms.
56-
You can install the binary packages from PyPi using ``pip``:
43+
Binary packages are available for major OSes (Win, Mac, Linux) and platforms.
44+
Install from PyPi using ``pip``:
5745

5846
.. code-block:: console
5947
6048
pip install blosc2 --upgrade
6149
62-
For conda users, you can install the package from the conda-forge channel:
50+
Conda users can install from conda-forge:
6351

6452
.. code-block:: console
6553
@@ -72,13 +60,15 @@ The documentation is available here:
7260

7361
https://blosc.org/python-blosc2/python-blosc2.html
7462

75-
Additionally, you can find some examples at:
63+
You can find examples at:
7664

7765
https://github.com/Blosc/python-blosc2/tree/main/examples
7866

79-
Finally, we taught a tutorial at the `PyData Global 2024 <https://pydata.org/global2024/>`_
80-
that you can find at: https://github.com/Blosc/Python-Blosc2-3.0-tutorial. There you will
81-
find different Jupyter notebook that explains the main features of Python-Blosc2.
67+
A tutorial from PyData Global 2024 is available at:
68+
69+
https://github.com/Blosc/Python-Blosc2-3.0-tutorial
70+
71+
It contains Jupyter notebooks explaining the main features of Python-Blosc2.
8272

8373
License
8474
=======
@@ -118,6 +108,7 @@ to the core development of the Blosc2 library:
118108
- Juan David Ibáñez
119109
- Ivan Vilata i Balaguer
120110
- Oumaima Ech.Chdig
111+
- Ricardo Sales Piquer
121112

122113
In addition, other people have participated to the project in different
123114
aspects:

RELEASE_NOTES.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
# Release notes
22

3-
## Changes from 3.2.0 to 3.2.1
3+
## Changes from 3.2.1 to 3.2.2
44

55
XXX version-specific blurb XXX
66

7+
## Changes from 3.2.0 to 3.2.1
8+
9+
* The array containers are now using the `__array_interface__` protocol to
10+
expose the data in the array. This allows for better interoperability with
11+
other libraries that support the `__array_interface__` protocol, like NumPy,
12+
CuPy, etc. Now, the range of functions that can be used within the `blosc2.jit`
13+
decorator is way larger, and essentially all NumPy functions should work now.
14+
15+
See examples at: https://github.com/Blosc/python-blosc2/blob/main/examples/ndarray/jit-numpy-funcs.py
16+
See benchmarks at: https://github.com/Blosc/python-blosc2/blob/main/bench/ndarray/jit-numpy-funcs.py
17+
18+
* The performance of constructors like `arange()`, `linspace()` and `fromiter()`
19+
has been improved. Now, they can be up to 3x faster, specially with large
20+
arrays.
21+
22+
* C-Blosc2 updated to 2.17.1. This fixes various UB as well as compiler warnings.
23+
724
## Changes from 3.1.1 to 3.2.0
825

926
* Structured arrays can be larger than 255 bytes now. This was a limitation

bench/ndarray/jit-expr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
cparams = blosc2.CParams(clevel=1, codec=blosc2.Codec.LZ4)
2424
cparams_out = blosc2.CParams(clevel=1, codec=blosc2.Codec.LZ4)
2525
print("Using cparams: ", cparams)
26-
check_result = True
26+
check_result = False
2727
# Lossy compression
2828
# filters = [blosc2.Filter.TRUNC_PREC, blosc2.Filter.SHUFFLE]
2929
# filters_meta = [8, 0] # keep 8 bits of precision in mantissa
@@ -150,5 +150,4 @@ def compute_expression_compr(a, b, c):
150150
print(f"Speedup: {tref / t1:.2f}x, out cratio: {cratio:.2f}x")
151151
if check_result:
152152
np.testing.assert_allclose(out, nout)
153-
154-
print("All results are equal!")
153+
print("All results are equal!")

0 commit comments

Comments
 (0)