From 89979cb5262b5891ab77dd39aef0f5eead3be21e Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 26 Oct 2023 13:13:03 +0200 Subject: [PATCH 1/5] BLD: Use NumPy nightly wheels for non-release builds This uses the NumPy nightlies for non-release builds to ensure the matplotlib nightlies uploaded are build against the new NumPy version. These nightlies are not tested, but if they were they should actually still be tested against the release NumPy. This is necessary to allow NumPy to enforce API changes, it does mean that potential C-API breaks in NumPy need quicker follow-up unfortunately (either in NumPy or in matplotlib). --- .github/workflows/cibuildwheel.yml | 35 +++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index cdb62658e6c9..9b311cc5c863 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -90,12 +90,35 @@ jobs: name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} runs-on: ${{ matrix.os }} env: - CIBW_BEFORE_BUILD: >- - pip install numpy>=1.25 && - rm -rf {package}/build - CIBW_BEFORE_BUILD_WINDOWS: >- - pip install delvewheel numpy>=1.25 && - rm -rf {package}/build + # The following commands branch based on whether we are on the main + # branch or have a PR into main. For these, we use the NumPy 2.0 + # nightlies to ensure future C-API/ABI compatibility. + # This branching becomes unnecessary when NumPy 2.0 is released. + # When using no-build-isolation we need to install all requirements. + CIBW_BEFORE_BUILD: + ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || + (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && + 'pip install meson-python pybind11 setuptools_scm "setuptools>=64" ninja && + pip install "numpy>=2.0.0.dev0" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" && + rm -rf {package}/build' + ) || + 'pip install "numpy>=1.25" && + rm -rf {package}/build' + }} + CIBW_BEFORE_BUILD_WINDOWS: + ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || + (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && + 'pip install delvewheel meson-python pybind11 setuptools_scm "setuptools>=64" ninja && + pip install "numpy>=2.0.0.dev0" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" && + rm -rf {package}/build' + ) || + 'pip install delvewheel "numpy>=1.25" && + rm -rf {package}/build' + }} + CIBW_BUILD_FRONTEND: >- + ${{ (((github.event_name == '' && github.ref == 'refs/heads/main') || + (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && + 'pip; args: --no-build-isolation') || 'build' }} CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- delvewheel repair -w {dest_dir} {wheel} CIBW_AFTER_BUILD: >- From b2f32ac429fa9c66574565c65f2d42e4418cf34c Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 26 Oct 2023 18:18:27 +0200 Subject: [PATCH 2/5] Update .github/workflows/cibuildwheel.yml Co-authored-by: Thomas A Caswell --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 9b311cc5c863..0ea480fc9a06 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -116,7 +116,7 @@ jobs: rm -rf {package}/build' }} CIBW_BUILD_FRONTEND: >- - ${{ (((github.event_name == '' && github.ref == 'refs/heads/main') || + ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && 'pip; args: --no-build-isolation') || 'build' }} CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- From 8081658910f69709ec93d01058b526937b1a592c Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 26 Oct 2023 19:36:16 +0200 Subject: [PATCH 3/5] Simplify everything and just use --pre, also remove pre install of NumPy? --- .github/workflows/cibuildwheel.yml | 40 ++++++++++-------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 0ea480fc9a06..16a5c4fdde8f 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -90,35 +90,21 @@ jobs: name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} runs-on: ${{ matrix.os }} env: - # The following commands branch based on whether we are on the main - # branch or have a PR into main. For these, we use the NumPy 2.0 - # nightlies to ensure future C-API/ABI compatibility. - # This branching becomes unnecessary when NumPy 2.0 is released. - # When using no-build-isolation we need to install all requirements. - CIBW_BEFORE_BUILD: - ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || - (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && - 'pip install meson-python pybind11 setuptools_scm "setuptools>=64" ninja && - pip install "numpy>=2.0.0.dev0" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" && - rm -rf {package}/build' - ) || - 'pip install "numpy>=1.25" && - rm -rf {package}/build' - }} - CIBW_BEFORE_BUILD_WINDOWS: - ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || - (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && - 'pip install delvewheel meson-python pybind11 setuptools_scm "setuptools>=64" ninja && - pip install "numpy>=2.0.0.dev0" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" && - rm -rf {package}/build' - ) || - 'pip install delvewheel "numpy>=1.25" && - rm -rf {package}/build' - }} + CIBW_BEFORE_BUILD: >- + rm -rf {package}/build + CIBW_BEFORE_BUILD_WINDOWS: >- + pip install delvewheel && + rm -rf {package}/build + # Live on the edge when building on main or a PR against main since + # these wheels are also used for nightlies and NumPy 2.0 transition + # requires using the NumPy 2.0 nightlies for compatibility. + # If using all `--pre` releases creates issues, the NumPy wheel can be + # istalled more targeted. CIBW_BUILD_FRONTEND: >- - ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || + ${{ (((github.event_name == 'main' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && - 'pip; args: --no-build-isolation') || 'build' }} + 'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"') || + 'build' }} CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- delvewheel repair -w {dest_dir} {wheel} CIBW_AFTER_BUILD: >- From 490f82804fe927eac4fbf3bbe127dda10595e823 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 26 Oct 2023 19:51:56 +0200 Subject: [PATCH 4/5] Update .github/workflows/cibuildwheel.yml Co-authored-by: Thomas A Caswell --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 16a5c4fdde8f..981411671436 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -101,7 +101,7 @@ jobs: # If using all `--pre` releases creates issues, the NumPy wheel can be # istalled more targeted. CIBW_BUILD_FRONTEND: >- - ${{ (((github.event_name == 'main' && github.ref == 'refs/heads/main') || + ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && 'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"') || 'build' }} From b0509d9c5c076b9341688094ab7d8556bde0d8b8 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 26 Oct 2023 22:00:59 +0200 Subject: [PATCH 5/5] Update .github/workflows/cibuildwheel.yml --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 981411671436..af733ff04502 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -102,7 +102,7 @@ jobs: # istalled more targeted. CIBW_BUILD_FRONTEND: >- ${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') || - (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main')) && + (github.event_name == 'pull_request' && github.base_ref == 'main')) && 'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"') || 'build' }} CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-