Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Blosc/python-blosc2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.1.1
Choose a base ref
...
head repository: Blosc/python-blosc2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing 349 changed files with 36,713 additions and 7,162 deletions.
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: FrancescAlted
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a self-contained code snippet reproducing the issue
2. Show the output of the error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
32 changes: 15 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Tests

on: [push, pull_request]
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- '**' # this matches all branches
pull_request:
branches:
- main

jobs:
build_wheels:
@@ -9,31 +17,21 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-build.txt
python -m pip install -r requirements-tests.txt
python -m pip install -r requirements-runtime.txt
- name: Build
run: |
python setup.py build_ext --inplace
run: pip install -e .[test]

- name: Test
run: |
python -m pytest
run: python -m pytest -m "not heavy and (network or not network)"
187 changes: 83 additions & 104 deletions .github/workflows/cibuildwheels.yml
Original file line number Diff line number Diff line change
@@ -1,157 +1,136 @@
name: Python wheels

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
# Trigger the workflow only for tags and PRs to the main branch
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

env:
CIBW_BUILD_VERBOSITY: 1
# Skip testing on aarch64 for now, as it is emulated on GitHub Actions and takes too long
# Now that github provides native arm64 runners, we can enable tests again
# CIBW_TEST_SKIP: "*linux*aarch64*"
# Skip PyPy wheels for now (numexpr needs some adjustments first)
# musllinux takes too long to build, and it's not worth it for now
CIBW_SKIP: "pp* *musllinux* *-win32"

jobs:

build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
# Only build wheels when tagging (typically a release)
if: startsWith(github.event.ref, 'refs/tags')
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.runs-on || matrix.os }}
permissions:
contents: write
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ARCHS_MACOS: "x86_64 arm64"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x86_64, aarch64]
exclude:
- os: windows-latest
arch: aarch64
- os: macos-latest
include:
# Linux x86_64 builds
- os: ubuntu-latest
arch: x86_64
cibw_pattern: "cp3{10,11,12,13}-manylinux*"
artifact_name: "linux-x86_64"

# Linux ARM64 builds (native runners)
- os: ubuntu-24.04-arm
arch: aarch64
cibw_pattern: "cp3{10,11,12,13}-manylinux*"
artifact_name: "linux-aarch64"
# Don't use native runners for now (looks like wait times are too long)
#runs-on: ["ubuntu-latest", "arm64"]

# Windows builds
- os: windows-latest
arch: x86_64
cibw_pattern: "cp3{10,11,12,13}-win64"
artifact_name: "windows-x86_64"

# macOS builds (universal2)
- os: macos-latest
arch: x86_64
cibw_pattern: "cp3{10,11,12,13}-macosx*"
artifact_name: "macos-universal2"
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
# Use the most recent released python
python-version: '3.x'

- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v2
# For some reason, this is still needed, even when using new arm64 runners
# - name: Set up QEMU
# if: ${{ matrix.arch == 'aarch64' }}
# uses: docker/setup-qemu-action@v3

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
id: ninja
uses: turtlesec-no/get-ninja@main

- name: Install MSVC amd64
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-build.txt
python -m pip install -r requirements-test-wheels.txt
python -m pip install -r requirements-runtime.txt
- name: Build wheels
uses: pypa/cibuildwheel@v2.23

- name: Build wheels (Windows)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: 'cp38-win_amd64 cp39-win_amd64 cp310-win_amd64 cp311-win_amd64'
CIBW_TEST_COMMAND: python -m pytest -m "not heavy" {project}/tests
CIBW_BUILD_VERBOSITY: 1

- name: Build wheels (Linux / Mac OSX)
if: runner.os != 'Windows'
- name: Make sdist
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-*'
CIBW_SKIP: '*-manylinux*_i686 *-musllinux_* ${{ env.CIBW_SKIP}}'
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_TEST_COMMAND: python -m pytest -m "not heavy" {project}/tests
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS_MACOS: "x86_64 arm64"

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl


build_sdist:
name: Build sdist
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
arch: [auto]
exclude:
- os: [ubuntu-latest]
# We don't support 32-bit platforms in python-blosc2
arch: x86

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- uses: actions/setup-python@v4
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-build.txt
python -m pip install -r requirements-tests.txt
python -m pip install -r requirements-runtime.txt
- name: Build sdist
run: |
python setup.py sdist
- name: Upload sdist package
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
python -m pip install build
python -m build --sdist --outdir wheelhouse .
- name: Build building extension from sdist package
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd ./dist
cd ./wheelhouse
tar -xzf blosc2-*.tar.gz
cd ./blosc2-*/
python setup.py build_ext --inplace
python -m venv sdist_test_env
source sdist_test_env/bin/activate
pip install pip --upgrade
pip install --break-system-packages -e .[test]
- name: Test sdist package with pytest
if: ${{ matrix.os == 'ubuntu-latest' }}
timeout-minutes: 10
run: |
cd ./dist/blosc2-*/
python -m pytest -m "not heavy"
cd ./wheelhouse/blosc2-*/
source sdist_test_env/bin/activate
python -m pytest tests/test_open.py tests/test_vlmeta.py tests/ndarray/test_evaluate.py
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
./wheelhouse/*.whl
./wheelhouse/*.tar.gz
upload_pypi:
needs: [ build_wheels, build_sdist ] # last but not least
needs: [ build_wheels]
runs-on: ubuntu-latest
# Only upload wheels when tagging (typically a release)
if: startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
path: ./wheelhouse
merge-multiple: true # Merge all the wheels artifacts into one directory

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.blosc_pypi_secret }}
packages-dir: wheelhouse/
64 changes: 64 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Python wheels for WASM
on:
push:
tags:
- '*'
pull_request:
branches:
- main

env:
CIBW_BUILD_VERBOSITY: 1
# cibuildwheel cannot choose for a specified version of pyodide yet
# PYODIDE_VERSION: 0.27.2

jobs:
build_wheels_wasm:
name: Build and test wheels for WASM on ${{ matrix.os }} for ${{ matrix.p_ver }}
runs-on: ubuntu-latest
permissions:
contents: write
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CMAKE_ARGS: "-DWITH_OPTIM=OFF"
CIBW_TEST_COMMAND: "pytest {project}/tests/ndarray/test_reductions.py"
strategy:
matrix:
os: [ubuntu-latest]
cibw_build: ["cp3{11,12,13}-*"]
p_ver: ["3.11-3.13"]

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake
- name: Install cibuildwheel
run: pip install cibuildwheel

- name: Build wheels
# Testing is automaticall made by cibuildwheel
run: cibuildwheel --platform pyodide

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-wasm-${{ matrix.os }}-${{ matrix.p_ver }}
path: ./wheelhouse/*.whl

# This is not working yet
# - name: Upload wheel to release
# if: startsWith(github.ref, 'refs/tags/')
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release upload ${GITHUB_REF_NAME} ./wheelhouse/*.whl
Loading