From ba35fc253c9ae29e3b513a7dbe86be350387face Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 12 Apr 2026 11:01:50 +0300 Subject: [PATCH 1/2] use Conda Meson instead of system Meson Otherwise, Meson insists on getting Cython to include system Python headers which simply doesn't work: ----- Sanity check compile stderr: In file included from /usr/include/python3.10/Python.h:8, from sanity_check_for_cython.c:19: /usr/include/python3.10/pyconfig.h:9:12: fatal error: aarch64-linux-gnu/python3.10/pyconfig.h: No such file or directory 9 | # include | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. ----- Also, avoid starting a new shell! --- .github/workflows/ci.yaml | 57 ++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e2bac06..2d422c89 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,8 +34,9 @@ jobs: miniforge-version: latest python-version: ${{ matrix.python-version }} - - name: Install compilers - run: conda install -y c-compiler cxx-compiler + - name: Install build dependencies and compilers + run: | + conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler - name: Install clang if: matrix.platform == 'macos-15-large' @@ -47,21 +48,33 @@ jobs: conda config --show-sources conda list --show-channel-urls + - name: Meson args - prefer Conda over system Python (Ubuntu) + if: startsWith(matrix.platform, 'ubuntu') + run: | + echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV + PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')" + echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV + echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV + echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV + - 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]" + python -m pip install -v \ + ".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]" \ + pytest else - python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" + python -m pip install -v \ + ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" \ + pytest fi - name: List installed packages run: python -m pip list - name: Run tests - shell: "bash -l {0}" - run: pytest -v + run: python -m pytest -v - uses: codecov/codecov-action@v5 with: @@ -100,8 +113,17 @@ jobs: miniforge-version: latest python-version: "3.13" - - name: Install compilers - run: conda install -y c-compiler cxx-compiler + - name: Install build dependencies and compilers + run: | + conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler + + - name: Meson args - prefer Conda over system Python (Ubuntu) + run: | + echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV + PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')" + echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV + echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV + echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV - name: Install numcodecs run: | @@ -115,7 +137,7 @@ jobs: run: python -m pip list - name: Run checksum tests - run: pytest -v tests/test_checksum32.py + run: python -m pytest -v tests/test_checksum32.py - uses: codecov/codecov-action@v5 with: @@ -154,17 +176,26 @@ jobs: miniforge-version: latest python-version: "3.13" - - name: Install compilers - run: conda install -y c-compiler cxx-compiler + - name: Install build dependencies and compilers + run: | + conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler + + - name: Meson args - prefer Conda over system Python (Ubuntu) + run: | + echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV + PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')" + echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV + echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV + echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV - name: Install numcodecs and Zarr run: | - python -m pip install -v ".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c + python -m pip install -v ".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c - name: List installed packages run: python -m pip list - name: Run Zarr integration tests - run: pytest tests/test_zarr3.py tests/test_zarr3_import.py + run: python -m pytest tests/test_zarr3.py tests/test_zarr3_import.py - uses: codecov/codecov-action@v5 with: From dc6cd1a7a312e5462e2a5cfae65ac2213312ba94 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 18 Apr 2026 18:24:08 +0200 Subject: [PATCH 2/2] Create the `test` env --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2d422c89..2378af35 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,6 +33,8 @@ jobs: channels: conda-forge miniforge-version: latest python-version: ${{ matrix.python-version }} + activate-environment: test + auto-activate-base: false - name: Install build dependencies and compilers run: | @@ -112,6 +114,8 @@ jobs: channels: conda-forge miniforge-version: latest python-version: "3.13" + activate-environment: test + auto-activate-base: false - name: Install build dependencies and compilers run: | @@ -175,6 +179,8 @@ jobs: channels: conda-forge miniforge-version: latest python-version: "3.13" + activate-environment: test + auto-activate-base: false - name: Install build dependencies and compilers run: |