Skip to content

Commit fcc32bd

Browse files
authored
Merge pull request #667 from rgommers/meson
BLD: switch to using Meson as the build system for PyWavelets
2 parents 7abdc62 + 711786f commit fcc32bd

22 files changed

+479
-791
lines changed

.github/workflows/tests.yml

+47-73
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
# Workflow to build and test wheels
21
name: Test
32

4-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- v1.**
8+
pull_request:
9+
branches:
10+
- master
11+
- v1.**
512

613
jobs:
714

@@ -12,15 +19,15 @@ jobs:
1219
MPLBACKEND: Agg
1320
CYTHON_TRACE: 1
1421
CYTHONSPEC: cython
15-
NUMPY_MIN: numpy==1.17.5
22+
NUMPY_MIN: numpy==1.20.3
1623
CYTHON_MIN: cython==0.29.18
1724
SCIPY_MIN: scipy==1.2.3
1825

1926
strategy:
2027
# Ensure that a wheel builder finishes even if another fails
2128
fail-fast: false
2229
matrix:
23-
python-version: [3.8, 3.9, '3.10', '3.11-dev']
30+
python-version: [3.8, 3.9, '3.10', '3.11']
2431
MINIMUM_REQUIREMENTS: [0]
2532
USE_SCIPY: [0]
2633
USE_SDIST: [0]
@@ -46,13 +53,9 @@ jobs:
4653
USE_WHEEL: 1
4754
OPTIONS_NAME: "install-from-wheel"
4855
- platform_id: manylinux_x86_64
49-
python-version: 3.9
56+
python-version: '3.11'
5057
PIP_FLAGS: "--pre"
51-
OPTIONS_NAME: "pre"
52-
- platform_id: manylinux_x86_64
53-
python-version: '3.11-dev'
54-
PIP_FLAGS: "--pre"
55-
OPTIONS_NAME: "pre"
58+
OPTIONS_NAME: "pre-releases"
5659

5760
steps:
5861
- name: Checkout PyWavelets
@@ -80,7 +83,7 @@ jobs:
8083
which python
8184
python --version
8285
# sudo apt-get install libatlas-base-dev
83-
pip install --upgrade pip wheel setuptools
86+
pip install --upgrade pip build
8487
# Set numpy version first, other packages link against it
8588
if [ "${MINIMUM_REQUIREMENTS}" == "1" ]; then
8689
pip install ${CYTHON_MIN}
@@ -91,24 +94,21 @@ jobs:
9194
pip install numpy
9295
if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi
9396
fi
94-
pip install matplotlib
95-
pip install pytest pytest-cov coverage codecov
97+
pip install matplotlib pytest pytest-cov coverage codecov
98+
9699
set -o pipefail
97-
if [ "${REFGUIDE_CHECK}" == "1" ]; then
98-
pip install sphinx numpydoc
99-
fi
100100
if [ "${USE_WHEEL}" == "1" ]; then
101-
pip install wheel;
102101
# Need verbose output or TravisCI will terminate after 10 minutes
103102
pip wheel . -v
104-
pip install PyWavelets*.whl -v
103+
pip install pywavelets*.whl
105104
elif [ "${USE_SDIST}" == "1" ]; then
106-
python setup.py sdist
105+
python -m build --sdist
106+
pip install dist/pyw*.tar.gz -v
107107
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
108-
pip install -e . -v
108+
pip install sphinx numpydoc
109+
pip install . -v
109110
else
110-
CFLAGS="--coverage" python setup.py build --build-lib build/lib/ --build-temp build/tmp/
111-
CFLAGS="--coverage" pip install -e . -v
111+
CFLAGS="--coverage" pip install . -v
112112
fi
113113
114114
- name: Run tests
@@ -118,48 +118,40 @@ jobs:
118118
USE_SDIST: ${{ matrix.USE_SDIST }}
119119
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
120120
run: |
121+
set -o pipefail
122+
# Move out of source directory to avoid finding local pywt
123+
pushd demo
121124
if [ "${USE_WHEEL}" == "1" ]; then
122-
pushd demo
123125
pytest --pyargs pywt
124-
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
125126
python ../pywt/tests/test_doc.py
126-
# fi
127-
popd
128127
elif [ "${USE_SDIST}" == "1" ]; then
129-
# Move out of source directory to avoid finding local pywt
130-
pushd dist
131-
pip install PyWavelets* -v
132128
pytest --pyargs pywt
133-
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
134129
python ../pywt/tests/test_doc.py
135-
# fi
136-
popd
137130
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
138131
python util/refguide_check.py --doctests
139132
else
140-
pushd demo
141133
pytest --pyargs pywt --cov=pywt --cov-config=../.coveragerc
142134
cp .coverage ..
143-
popd
144135
fi
136+
popd
145137
146138
147139
test_pywavelets_macos:
148-
name: macos-cp${{ matrix.python-version }}
140+
name: macos-cp${{ matrix.python-version }}-${{ matrix.OPTIONS_NAME }}
149141
runs-on: macos-latest
150142
env:
151143
MPLBACKEND: Agg
152144
CYTHON_TRACE: 1
153145
CYTHONSPEC: cython
154-
NUMPY_MIN: numpy==1.17.5
146+
NUMPY_MIN: numpy==1.20.3
155147
CYTHON_MIN: cython==0.29.18
156148
SCIPY_MIN: scipy==1.2.3
157149

158150
strategy:
159151
# Ensure that a wheel builder finishes even if another fails
160152
fail-fast: false
161153
matrix:
162-
python-version: [3.8, '3.10', '3.11-dev']
154+
python-version: [3.8, '3.11']
163155
MINIMUM_REQUIREMENTS: [0]
164156
USE_SCIPY: [0]
165157
USE_SDIST: [0]
@@ -168,12 +160,12 @@ jobs:
168160
PIP_FLAGS: [""]
169161
OPTIONS_NAME: ["default"]
170162
include:
171-
- python-version: 3.8
163+
- python-version: '3.8'
172164
MINIMUM_REQUIREMENTS: 1
173165
OPTIONS_NAME: "osx-minimum-req"
174-
- python-version: 3.9
166+
- python-version: '3.10'
175167
PIP_FLAGS: "--pre"
176-
OPTIONS_NAME: "osx-pre"
168+
OPTIONS_NAME: "pre-releases"
177169

178170
steps:
179171
- name: Checkout PyWavelets
@@ -199,39 +191,31 @@ jobs:
199191
uname -a
200192
df -h
201193
ulimit -a
202-
# ccache -s
203194
which python
204195
python --version
205-
# sudo apt-get install libatlas-base-dev
206-
pip install --upgrade pip wheel setuptools
196+
pip install --upgrade pip build
207197
# Set numpy version first, other packages link against it
208198
if [ "${MINIMUM_REQUIREMENTS}" == "1" ]; then
209-
pip install ${CYTHON_MIN}
210-
pip install ${NUMPY_MIN}
199+
pip install ${CYTHON_MIN} ${NUMPY_MIN}
211200
if [ "${USE_SCIPY}" == "1" ]; then pip install ${SCIPY_MIN}; fi
212201
else
213-
pip install cython
214-
pip install numpy
202+
pip install cython numpy
215203
if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi
216204
fi
217-
pip install matplotlib
218-
pip install pytest pytest-cov coverage codecov
205+
pip install matplotlib pytest pytest-cov coverage codecov
206+
219207
set -o pipefail
220-
if [ "${REFGUIDE_CHECK}" == "1" ]; then
221-
pip install sphinx numpydoc
222-
fi
223208
if [ "${USE_WHEEL}" == "1" ]; then
224-
pip install wheel;
225-
# Need verbose output or TravisCI will terminate after 10 minutes
226209
pip wheel . -v
227-
pip install PyWavelets*.whl -v
210+
pip install pywavelets*.whl -v
228211
elif [ "${USE_SDIST}" == "1" ]; then
229-
python setup.py sdist
212+
python -m build --sdist
213+
pip install pywavelets* -v
230214
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
231-
pip install -e . -v
215+
pip install sphinx numpydoc
216+
pip install . -v
232217
else
233-
CFLAGS="--coverage" python setup.py build --build-lib build/lib/ --build-temp build/tmp/
234-
CFLAGS="--coverage" pip install -e . -v
218+
pip install . -v
235219
fi
236220
237221
- name: Run tests
@@ -241,27 +225,17 @@ jobs:
241225
USE_SDIST: ${{ matrix.USE_SDIST }}
242226
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
243227
run: |
228+
# Move out of source directory to avoid finding local pywt
229+
pushd demo
244230
if [ "${USE_WHEEL}" == "1" ]; then
245-
pushd demo
246231
pytest --pyargs pywt
247-
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
248232
python ../pywt/tests/test_doc.py
249-
# fi
250-
popd
251233
elif [ "${USE_SDIST}" == "1" ]; then
252-
# Move out of source directory to avoid finding local pywt
253-
pushd dist
254-
pip install PyWavelets* -v
255234
pytest --pyargs pywt
256-
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
257235
python ../pywt/tests/test_doc.py
258-
# fi
259-
popd
260236
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
261237
python util/refguide_check.py --doctests
262238
else
263-
pushd demo
264-
pytest --pyargs pywt --cov=pywt --cov-config=../.coveragerc
265-
cp .coverage ..
266-
popd
239+
pytest --pyargs pywt
267240
fi
241+
popd

.github/workflows/wheel_tests_and_release.yml

+55-19
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ jobs:
9494
os: [macos-latest]
9595
cibw_python: [ "cp38-*", "cp39-*", "cp310-*" , "cp311-*" ]
9696
cibw_arch: [ "x86_64", "arm64"]
97-
env:
98-
MACOSX_DEPLOYMENT_TARGET: "10.13"
9997
steps:
10098
- uses: actions/checkout@v3
10199
with:
@@ -109,20 +107,25 @@ jobs:
109107
- name: Install cibuildwheel
110108
run: |
111109
python -m pip install cibuildwheel
110+
112111
- name: Build wheels for CPython (MacOS)
113112
run: |
113+
# We need to set both MACOS_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET
114+
# until there is a new release with this commit:
115+
# https://github.com/mesonbuild/meson-python/pull/309 (should be in 0.13.0)
116+
if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then
117+
export MACOSX_DEPLOYMENT_TARGET=11.0
118+
export MACOS_DEPLOYMENT_TARGET=11.0
119+
else
120+
export MACOSX_DEPLOYMENT_TARGET=10.13
121+
export MACOS_DEPLOYMENT_TARGET=10.13
122+
fi
123+
echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
124+
114125
python -m cibuildwheel --output-dir dist
115126
env:
116127
CIBW_BUILD: ${{ matrix.cibw_python }}
117128
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
118-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
119-
CIBW_MANYLINUX_I686_IMAGE: manylinux1
120-
CC: /usr/bin/clang
121-
CXX: /usr/bin/clang++
122-
# CPPFLAGS: "-Xpreprocessor -fopenmp"
123-
# CFLAGS: "-Wno-implicit-function-declaration -I/usr/local/opt/libomp/include"
124-
# CXXFLAGS: "-I/usr/local/opt/libomp/include"
125-
# LDFLAGS: "-Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp"
126129

127130
- uses: actions/upload-artifact@v3
128131
with:
@@ -138,10 +141,6 @@ jobs:
138141
os: [windows-latest]
139142
cibw_arch: ["AMD64", "x86"]
140143
cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
141-
# exclude:
142-
# - os: windows-latest
143-
# cibw_python: "cp310-*"
144-
# cibw_arch: x86
145144
steps:
146145
- uses: actions/checkout@v3
147146
with:
@@ -155,14 +154,51 @@ jobs:
155154
- name: Install cibuildwheel
156155
run: |
157156
python -m pip install cibuildwheel
158-
- name: Build Windows wheels for CPython
157+
158+
- name: Build x86-64 (64-bit) Windows wheels for CPython
159+
if: matrix.cibw_arch == 'AMD64'
160+
# From https://github.com/actions/virtual-environments/issues/294#issuecomment-588090582,
161+
# with additional -arch=amd64 flag to vsdevcmd.bat. Fix synced from scikit-image.
159162
run: |
163+
function Invoke-VSDevEnvironment {
164+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
165+
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
166+
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
167+
& "${env:COMSPEC}" /s /c "`"$Command`" -arch=amd64 -no_logo && set" | Foreach-Object {
168+
if ($_ -match '^([^=]+)=(.*)') {
169+
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
170+
}
171+
}
172+
}
173+
Invoke-VSDevEnvironment
174+
Get-Command rc.exe | Format-Table -AutoSize
175+
176+
python -m cibuildwheel --output-dir dist
177+
env:
178+
CIBW_BUILD: ${{ matrix.cibw_python }}
179+
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
180+
181+
- name: Build x86 (32-bit) Windows wheels for CPython
182+
if: matrix.cibw_arch == 'x86'
183+
# Same as above, but without `-arch=amd64` target arch selection argument
184+
run: |
185+
function Invoke-VSDevEnvironment {
186+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
187+
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
188+
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
189+
& "${env:COMSPEC}" /s /c "`"$Command`" -no_logo && set" | Foreach-Object {
190+
if ($_ -match '^([^=]+)=(.*)') {
191+
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
192+
}
193+
}
194+
}
195+
Invoke-VSDevEnvironment
196+
Get-Command rc.exe | Format-Table -AutoSize
197+
160198
python -m cibuildwheel --output-dir dist
161199
env:
162200
CIBW_BUILD: ${{ matrix.cibw_python }}
163201
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
164-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
165-
CIBW_MANYLINUX_I686_IMAGE: manylinux1
166202

167203
- uses: actions/upload-artifact@v3
168204
with:
@@ -198,12 +234,12 @@ jobs:
198234
- name: Publish the source distribution on PyPI
199235
run: |
200236
PYWT_VERSION=$(git describe --tags)
201-
python setup.py sdist
237+
python -m build --sdist
202238
ls -la ${{ github.workspace }}/dist
203239
# We prefer to release wheels before source because otherwise there is a
204240
# small window during which users who pip install pywt will require compilation.
205241
twine upload ${{ github.workspace }}/dist/*.whl
206-
twine upload ${{ github.workspace }}/dist/PyWavelets-${PYWT_VERSION:1}.tar.gz
242+
twine upload ${{ github.workspace }}/dist/pywavelets-${PYWT_VERSION:1}.tar.gz
207243
env:
208244
TWINE_USERNAME: __token__
209245
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pip-log.txt
2626
# Project working files
2727
# Expanded Cython
2828
pywt/_extensions/*.[ch]
29-
pywt/_c99_config.py
29+
pywt/_extensions/_c99_config.py
3030
pywt/_extensions/config.pxi
3131
cythonize.dat
3232
pywt/version.py

0 commit comments

Comments
 (0)