Skip to content

Commit

Permalink
Merge pull request #667 from rgommers/meson
Browse files Browse the repository at this point in the history
BLD: switch to using Meson as the build system for PyWavelets
  • Loading branch information
rgommers committed Apr 4, 2023
2 parents 7abdc62 + 711786f commit fcc32bd
Show file tree
Hide file tree
Showing 22 changed files with 479 additions and 791 deletions.
120 changes: 47 additions & 73 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Workflow to build and test wheels
name: Test

on: [push, pull_request]
on:
push:
branches:
- master
- v1.**
pull_request:
branches:
- master
- v1.**

jobs:

Expand All @@ -12,15 +19,15 @@ jobs:
MPLBACKEND: Agg
CYTHON_TRACE: 1
CYTHONSPEC: cython
NUMPY_MIN: numpy==1.17.5
NUMPY_MIN: numpy==1.20.3
CYTHON_MIN: cython==0.29.18
SCIPY_MIN: scipy==1.2.3

strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', '3.11-dev']
python-version: [3.8, 3.9, '3.10', '3.11']
MINIMUM_REQUIREMENTS: [0]
USE_SCIPY: [0]
USE_SDIST: [0]
Expand All @@ -46,13 +53,9 @@ jobs:
USE_WHEEL: 1
OPTIONS_NAME: "install-from-wheel"
- platform_id: manylinux_x86_64
python-version: 3.9
python-version: '3.11'
PIP_FLAGS: "--pre"
OPTIONS_NAME: "pre"
- platform_id: manylinux_x86_64
python-version: '3.11-dev'
PIP_FLAGS: "--pre"
OPTIONS_NAME: "pre"
OPTIONS_NAME: "pre-releases"

steps:
- name: Checkout PyWavelets
Expand Down Expand Up @@ -80,7 +83,7 @@ jobs:
which python
python --version
# sudo apt-get install libatlas-base-dev
pip install --upgrade pip wheel setuptools
pip install --upgrade pip build
# Set numpy version first, other packages link against it
if [ "${MINIMUM_REQUIREMENTS}" == "1" ]; then
pip install ${CYTHON_MIN}
Expand All @@ -91,24 +94,21 @@ jobs:
pip install numpy
if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi
fi
pip install matplotlib
pip install pytest pytest-cov coverage codecov
pip install matplotlib pytest pytest-cov coverage codecov
set -o pipefail
if [ "${REFGUIDE_CHECK}" == "1" ]; then
pip install sphinx numpydoc
fi
if [ "${USE_WHEEL}" == "1" ]; then
pip install wheel;
# Need verbose output or TravisCI will terminate after 10 minutes
pip wheel . -v
pip install PyWavelets*.whl -v
pip install pywavelets*.whl
elif [ "${USE_SDIST}" == "1" ]; then
python setup.py sdist
python -m build --sdist
pip install dist/pyw*.tar.gz -v
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
pip install -e . -v
pip install sphinx numpydoc
pip install . -v
else
CFLAGS="--coverage" python setup.py build --build-lib build/lib/ --build-temp build/tmp/
CFLAGS="--coverage" pip install -e . -v
CFLAGS="--coverage" pip install . -v
fi
- name: Run tests
Expand All @@ -118,48 +118,40 @@ jobs:
USE_SDIST: ${{ matrix.USE_SDIST }}
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
run: |
set -o pipefail
# Move out of source directory to avoid finding local pywt
pushd demo
if [ "${USE_WHEEL}" == "1" ]; then
pushd demo
pytest --pyargs pywt
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
python ../pywt/tests/test_doc.py
# fi
popd
elif [ "${USE_SDIST}" == "1" ]; then
# Move out of source directory to avoid finding local pywt
pushd dist
pip install PyWavelets* -v
pytest --pyargs pywt
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
python ../pywt/tests/test_doc.py
# fi
popd
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
python util/refguide_check.py --doctests
else
pushd demo
pytest --pyargs pywt --cov=pywt --cov-config=../.coveragerc
cp .coverage ..
popd
fi
popd
test_pywavelets_macos:
name: macos-cp${{ matrix.python-version }}
name: macos-cp${{ matrix.python-version }}-${{ matrix.OPTIONS_NAME }}
runs-on: macos-latest
env:
MPLBACKEND: Agg
CYTHON_TRACE: 1
CYTHONSPEC: cython
NUMPY_MIN: numpy==1.17.5
NUMPY_MIN: numpy==1.20.3
CYTHON_MIN: cython==0.29.18
SCIPY_MIN: scipy==1.2.3

strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
python-version: [3.8, '3.10', '3.11-dev']
python-version: [3.8, '3.11']
MINIMUM_REQUIREMENTS: [0]
USE_SCIPY: [0]
USE_SDIST: [0]
Expand All @@ -168,12 +160,12 @@ jobs:
PIP_FLAGS: [""]
OPTIONS_NAME: ["default"]
include:
- python-version: 3.8
- python-version: '3.8'
MINIMUM_REQUIREMENTS: 1
OPTIONS_NAME: "osx-minimum-req"
- python-version: 3.9
- python-version: '3.10'
PIP_FLAGS: "--pre"
OPTIONS_NAME: "osx-pre"
OPTIONS_NAME: "pre-releases"

steps:
- name: Checkout PyWavelets
Expand All @@ -199,39 +191,31 @@ jobs:
uname -a
df -h
ulimit -a
# ccache -s
which python
python --version
# sudo apt-get install libatlas-base-dev
pip install --upgrade pip wheel setuptools
pip install --upgrade pip build
# Set numpy version first, other packages link against it
if [ "${MINIMUM_REQUIREMENTS}" == "1" ]; then
pip install ${CYTHON_MIN}
pip install ${NUMPY_MIN}
pip install ${CYTHON_MIN} ${NUMPY_MIN}
if [ "${USE_SCIPY}" == "1" ]; then pip install ${SCIPY_MIN}; fi
else
pip install cython
pip install numpy
pip install cython numpy
if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi
fi
pip install matplotlib
pip install pytest pytest-cov coverage codecov
pip install matplotlib pytest pytest-cov coverage codecov
set -o pipefail
if [ "${REFGUIDE_CHECK}" == "1" ]; then
pip install sphinx numpydoc
fi
if [ "${USE_WHEEL}" == "1" ]; then
pip install wheel;
# Need verbose output or TravisCI will terminate after 10 minutes
pip wheel . -v
pip install PyWavelets*.whl -v
pip install pywavelets*.whl -v
elif [ "${USE_SDIST}" == "1" ]; then
python setup.py sdist
python -m build --sdist
pip install pywavelets* -v
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
pip install -e . -v
pip install sphinx numpydoc
pip install . -v
else
CFLAGS="--coverage" python setup.py build --build-lib build/lib/ --build-temp build/tmp/
CFLAGS="--coverage" pip install -e . -v
pip install . -v
fi
- name: Run tests
Expand All @@ -241,27 +225,17 @@ jobs:
USE_SDIST: ${{ matrix.USE_SDIST }}
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
run: |
# Move out of source directory to avoid finding local pywt
pushd demo
if [ "${USE_WHEEL}" == "1" ]; then
pushd demo
pytest --pyargs pywt
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
python ../pywt/tests/test_doc.py
# fi
popd
elif [ "${USE_SDIST}" == "1" ]; then
# Move out of source directory to avoid finding local pywt
pushd dist
pip install PyWavelets* -v
pytest --pyargs pywt
# if [[ "${TRAVIS_CPU_ARCH}" != "arm64" ]]; then
python ../pywt/tests/test_doc.py
# fi
popd
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
python util/refguide_check.py --doctests
else
pushd demo
pytest --pyargs pywt --cov=pywt --cov-config=../.coveragerc
cp .coverage ..
popd
pytest --pyargs pywt
fi
popd
74 changes: 55 additions & 19 deletions .github/workflows/wheel_tests_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ jobs:
os: [macos-latest]
cibw_python: [ "cp38-*", "cp39-*", "cp310-*" , "cp311-*" ]
cibw_arch: [ "x86_64", "arm64"]
env:
MACOSX_DEPLOYMENT_TARGET: "10.13"
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -109,20 +107,25 @@ jobs:
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build wheels for CPython (MacOS)
run: |
# We need to set both MACOS_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET
# until there is a new release with this commit:
# https://github.com/mesonbuild/meson-python/pull/309 (should be in 0.13.0)
if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then
export MACOSX_DEPLOYMENT_TARGET=11.0
export MACOS_DEPLOYMENT_TARGET=11.0
else
export MACOSX_DEPLOYMENT_TARGET=10.13
export MACOS_DEPLOYMENT_TARGET=10.13
fi
echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
CIBW_MANYLINUX_I686_IMAGE: manylinux1
CC: /usr/bin/clang
CXX: /usr/bin/clang++
# CPPFLAGS: "-Xpreprocessor -fopenmp"
# CFLAGS: "-Wno-implicit-function-declaration -I/usr/local/opt/libomp/include"
# CXXFLAGS: "-I/usr/local/opt/libomp/include"
# LDFLAGS: "-Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp"

- uses: actions/upload-artifact@v3
with:
Expand All @@ -138,10 +141,6 @@ jobs:
os: [windows-latest]
cibw_arch: ["AMD64", "x86"]
cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
# exclude:
# - os: windows-latest
# cibw_python: "cp310-*"
# cibw_arch: x86
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -155,14 +154,51 @@ jobs:
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build Windows wheels for CPython
- name: Build x86-64 (64-bit) Windows wheels for CPython
if: matrix.cibw_arch == 'AMD64'
# From https://github.com/actions/virtual-environments/issues/294#issuecomment-588090582,
# with additional -arch=amd64 flag to vsdevcmd.bat. Fix synced from scikit-image.
run: |
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -arch=amd64 -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Invoke-VSDevEnvironment
Get-Command rc.exe | Format-Table -AutoSize
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}

- name: Build x86 (32-bit) Windows wheels for CPython
if: matrix.cibw_arch == 'x86'
# Same as above, but without `-arch=amd64` target arch selection argument
run: |
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Invoke-VSDevEnvironment
Get-Command rc.exe | Format-Table -AutoSize
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
CIBW_MANYLINUX_I686_IMAGE: manylinux1

- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -198,12 +234,12 @@ jobs:
- name: Publish the source distribution on PyPI
run: |
PYWT_VERSION=$(git describe --tags)
python setup.py sdist
python -m build --sdist
ls -la ${{ github.workspace }}/dist
# We prefer to release wheels before source because otherwise there is a
# small window during which users who pip install pywt will require compilation.
twine upload ${{ github.workspace }}/dist/*.whl
twine upload ${{ github.workspace }}/dist/PyWavelets-${PYWT_VERSION:1}.tar.gz
twine upload ${{ github.workspace }}/dist/pywavelets-${PYWT_VERSION:1}.tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pip-log.txt
# Project working files
# Expanded Cython
pywt/_extensions/*.[ch]
pywt/_c99_config.py
pywt/_extensions/_c99_config.py
pywt/_extensions/config.pxi
cythonize.dat
pywt/version.py
Expand Down

0 comments on commit fcc32bd

Please sign in to comment.