Skip to content

Commit 26fc0d5

Browse files
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 <aarch64-linux-gnu/python3.10/pyconfig.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. ----- Also, avoid starting a new shell!
1 parent 562ff8e commit 26fc0d5

1 file changed

Lines changed: 42 additions & 65 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 42 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ jobs:
3434
miniforge-version: latest
3535
python-version: ${{ matrix.python-version }}
3636

37-
- name: Install compilers
38-
run: conda install -y c-compiler cxx-compiler
37+
- name: Install build dependencies and compilers
38+
run: |
39+
conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler
3940
4041
- name: Install clang
4142
if: matrix.platform == 'macos-15-large'
@@ -47,43 +48,33 @@ jobs:
4748
conda config --show-sources
4849
conda list --show-channel-urls
4950
50-
- name: Meson args - use active Python include/lib (Ubuntu)
51+
- name: Meson args - prefer Conda over system Python (Ubuntu)
5152
if: startsWith(matrix.platform, 'ubuntu')
5253
run: |
53-
PY_INC=$(python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
54-
echo "PY_INC=$PY_INC" >> $GITHUB_ENV
55-
echo "MESON_SETUP_ARGS=-Dc_args=-I${PY_INC} -Dc_link_args=-L${CONDA_PREFIX}/lib" >> $GITHUB_ENV
54+
echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV
55+
PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
56+
echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV
57+
echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV
58+
echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV
5659
5760
- name: Install numcodecs
5861
run: |
59-
if [[ "${{ startsWith(matrix.platform, 'ubuntu') }}" == "true" ]]; then
60-
# TODO: Remove this conditional when pcodec supports Python 3.14
61-
if [[ "${{ matrix.python-version }}" == "3.14" ]]; then
62-
python -m pip install -v \
63-
--config-settings="setup-args=${MESON_SETUP_ARGS}" \
64-
".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]"
65-
else
66-
python -m pip install -v \
67-
--config-settings="setup-args=${MESON_SETUP_ARGS}" \
68-
".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]"
69-
fi
62+
# TODO: Remove this conditional when pcodec supports Python 3.14
63+
if [[ "${{ matrix.python-version }}" == "3.14" ]]; then
64+
python -m pip install -v \
65+
".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]" \
66+
pytest
7067
else
71-
# TODO: Remove this conditional when pcodec supports Python 3.14
72-
if [[ "${{ matrix.python-version }}" == "3.14" ]]; then
73-
python -m pip install -v \
74-
".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]"
75-
else
76-
python -m pip install -v \
77-
".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]"
78-
fi
68+
python -m pip install -v \
69+
".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" \
70+
pytest
7971
fi
8072
8173
- name: List installed packages
8274
run: python -m pip list
8375

8476
- name: Run tests
85-
shell: "bash -l {0}"
86-
run: pytest -v
77+
run: python -m pytest -v
8778

8879
- uses: codecov/codecov-action@v5
8980
with:
@@ -122,41 +113,31 @@ jobs:
122113
miniforge-version: latest
123114
python-version: "3.13"
124115

125-
- name: Install compilers
126-
run: conda install -y c-compiler cxx-compiler
116+
- name: Install build dependencies and compilers
117+
run: |
118+
conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler
127119
128-
- name: Meson args - use active Python include/lib (Ubuntu)
129-
if: startsWith(matrix.platform, 'ubuntu')
120+
- name: Meson args - prefer Conda over system Python (Ubuntu)
130121
run: |
131-
PY_INC=$(python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
132-
echo "PY_INC=$PY_INC" >> $GITHUB_ENV
133-
echo "MESON_SETUP_ARGS=-Dc_args=-I${PY_INC} -Dc_link_args=-L${CONDA_PREFIX}/lib" >> $GITHUB_ENV
122+
echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV
123+
PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
124+
echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV
125+
echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV
126+
echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV
134127
135128
- name: Install numcodecs
136129
run: |
137-
if [[ "${{ startsWith(matrix.platform, 'ubuntu') }}" == "true" ]]; then
138-
if [[ -n "${{ matrix.extras }}" ]]; then
139-
python -m pip install -v \
140-
--config-settings="setup-args=${MESON_SETUP_ARGS}" \
141-
".[${{ matrix.extras }},test]"
142-
else
143-
python -m pip install -v \
144-
--config-settings="setup-args=${MESON_SETUP_ARGS}" \
145-
".[test]"
146-
fi
130+
if [[ -n "${{ matrix.extras }}" ]]; then
131+
python -m pip install -v ".[${{ matrix.extras }},test]"
147132
else
148-
if [[ -n "${{ matrix.extras }}" ]]; then
149-
python -m pip install -v ".[${{ matrix.extras }},test]"
150-
else
151-
python -m pip install -v ".[test]"
152-
fi
133+
python -m pip install -v ".[test]"
153134
fi
154135
155136
- name: List installed packages
156137
run: python -m pip list
157138

158139
- name: Run checksum tests
159-
run: pytest -v tests/test_checksum32.py
140+
run: python -m pytest -v tests/test_checksum32.py
160141

161142
- uses: codecov/codecov-action@v5
162143
with:
@@ -195,30 +176,26 @@ jobs:
195176
miniforge-version: latest
196177
python-version: "3.13"
197178

198-
- name: Install compilers
199-
run: conda install -y c-compiler cxx-compiler
179+
- name: Install build dependencies and compilers
180+
run: |
181+
conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler
200182
201-
- name: Meson args - use active Python include/lib (Ubuntu)
202-
if: startsWith(matrix.platform, 'ubuntu')
183+
- name: Meson args - prefer Conda over system Python (Ubuntu)
203184
run: |
204-
PY_INC=$(python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
205-
echo "PY_INC=$PY_INC" >> $GITHUB_ENV
206-
echo "MESON_SETUP_ARGS=-Dc_args=-I${PY_INC} -Dc_link_args=-L${CONDA_PREFIX}/lib" >> $GITHUB_ENV
185+
echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV
186+
PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
187+
echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV
188+
echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV
189+
echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV
207190
208191
- name: Install numcodecs and Zarr
209192
run: |
210-
if [[ "${{ startsWith(matrix.platform, 'ubuntu') }}" == "true" ]]; then
211-
python -m pip install -v \
212-
--config-settings="setup-args=${MESON_SETUP_ARGS}" \
213-
".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c
214-
else
215-
python -m pip install -v ".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c
216-
fi
193+
python -m pip install -v ".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c
217194
- name: List installed packages
218195
run: python -m pip list
219196

220197
- name: Run Zarr integration tests
221-
run: pytest tests/test_zarr3.py tests/test_zarr3_import.py
198+
run: python -m pytest tests/test_zarr3.py tests/test_zarr3_import.py
222199

223200
- uses: codecov/codecov-action@v5
224201
with:

0 commit comments

Comments
 (0)