From 8748dacf7b0ebb698dcb829fd3e97d721c7a0f7c Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:17:45 +0200 Subject: [PATCH 01/46] Try matplotlib style --- .github/workflows/build-wheels.yaml | 171 ++++++++++++++++++++++++++++ pyproject.toml | 23 +++- 2 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build-wheels.yaml diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml new file mode 100644 index 0000000..02a1aac --- /dev/null +++ b/.github/workflows/build-wheels.yaml @@ -0,0 +1,171 @@ +name: Build +# Current draft based on +# https://github.com/matplotlib/matplotlib/blob/main/.github/workflows/cibuildwheel.yml + +# TODO: only run on published releases +# on: +# release: +# types: [published] +on: [push] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + # - os: ubuntu-latest + # cibw_archs: "x86_64" + # - os: ubuntu-24.04-arm + # cibw_archs: "aarch64" + - os: windows-latest + cibw_archs: "AMD64" + - os: windows-11-arm + cibw_archs: "ARM64" + # - os: macos-13 + # cibw_archs: "x86_64" + # - os: macos-14 + # cibw_archs: "arm64" + env: + # CIBW_BEFORE_BUILD: >- + # rm -rf {package}/build + CIBW_BEFORE_BUILD_WINDOWS: >- + pip install delvewheel + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- + delvewheel repair -w {dest_dir} {wheel} + # TODO: switch to building based on locked src + # and use tests-min-locked here + CIBW_TEST_EXTRAS: >- + tests-min + CIBW_TEST_COMMAND: >- + pytest {project}/tests + # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have + # # MinGW on PATH that would be picked otherwise), switch to a static build for + # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, + # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while + # # keeping shared state with the rest of the Python process/extensions. + # CIBW_CONFIG_SETTINGS_WINDOWS: >- + # setup-args="--vsenv" + # setup-args="-Db_vscrt=mt" + # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" + # CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + # CIBW_SKIP: "*-musllinux_aarch64" + # CIBW_TEST_COMMAND: >- + # python {package}/ci/check_version_number.py + # MACOSX_DEPLOYMENT_TARGET: "10.12" + + steps: + - uses: actions/checkout@v5 + + - name: Build wheels for CPython 3.12 + uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 + with: + package-dir: . + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + env: + CIBW_BUILD: "cp312-*" + CIBW_ARCHS: ${{ matrix.cibw_archs }} + + # - name: Setup Python + # if: ${{ startsWith(matrix.os, 'windows') }} + # uses: actions/setup-python@v5 + # with: + # python-version: '3.x' + # + # # Maybe not necessary, source: + # # https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/ + # # and + # # https://github.com/numpy/numpy/blob/71eebaf8513dfd6ed40b0c689702d81e3f6f2527/.github/workflows/wheels.yml#L123 + # - name: Setup MSVC developer shell (32-bit) + # if: ${{ matrix.os == 'windows-2022' }} + # uses: bus1/cabuild/action/msdevshell@v1 + # with: + # architecture: x64 + # + # - name: Install Fortran compiler + # # When building from source, ensure we have a Fortran compiler + # if: ${{ startsWith(matrix.os, 'macos') }} + # uses: fortran-lang/setup-fortran@v1 + # id: setup-fortran + # with: + # # TODO: figure out whether we need/want to use other compilers too + # compiler: "gcc" + # version: "13" + # + # - name: Set macOS-13 specific flags + # if: matrix.os == 'macos-13' + # run: | + # echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> "$GITHUB_ENV" + # + # - name: Set macOS-14 specific flags + # if: matrix.os == 'macos-14' + # run: | + # echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV" + # + # - name: Build wheels + # uses: pypa/cibuildwheel@v3.1.4 + # # env: + # # CIBW_SOME_OPTION: value + # # ... + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} + path: ./wheelhouse/*.whl + if-no-files-found: error + + # make-sdist: + # name: Make source distribution + # runs-on: "ubuntu-latest" + # + # steps: + # - name: Check out repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # + # - uses: ./.github/actions/setup + # with: + # python-version: ${{ matrix.python-version }} + # uv-dependency-install-flags: "--all-extras --group dev" + # + # - name: Create source distribution + # run: uv build --sdist + # + # - name: Upload the source distribution artefact + # uses: actions/upload-artifact@v4 + # with: + # name: cibw-sdist + # path: dist/*.tar.gz + + deploy-pypi: + # TODO: turn back on + # needs: [ build-wheels, make-sdist ] + needs: [build-wheels] + # Having an environment for deployment is strongly recommend by PyPI + # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions + # You can comment this line out if you don't want it. + # # TODO: turn back on when we only run this on main + # environment: deploy + # permissions: + # # this permission is mandatory for trusted publishing with PyPI + # id-token: write + runs-on: ubuntu-latest + steps: + - name: Download artefacts + uses: actions/download-artifact@v5 + with: + pattern: cibw-* + path: dist + merge-multiple: true + - name: Publish to PyPI + run: | + ls dist + # uv publish diff --git a/pyproject.toml b/pyproject.toml index ac8fd09..e575b47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,20 +123,31 @@ all-dev = [ [build-system] build-backend = "mesonpy" requires = [ - "meson-python>=0.15.0", - "numpy", + "meson-python>=0.15.0", + # "numpy", + "numpy>=1.26.0; python_version < '3.13'", + "numpy>=2.1.0; python_version >= '3.13'", ] # https://mesonbuild.com/meson-python/how-to-guides/meson-args.html [tool.meson-python.args] setup = [ - '--default-library=static', - '-Dpyprojectwheelbuild=enabled', - ] + '--default-library=static', + '-Dpyprojectwheelbuild=enabled', +] install = [ -'--skip-subprojects', + '--skip-subprojects', ] +# See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 +# FIXME: Remove this override once dependencies are available on PyPI. +[[tool.cibuildwheel.overrides]] +select = "*-win_arm64" +before-test = """\ + pip install --pre \ + --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ + numpy""" + [tool.coverage.run] source = [ "src", From ea8cf2f98252549e5d4624840786aaa21c4a0a5a Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:18:22 +0200 Subject: [PATCH 02/46] Fix up indentation --- .github/workflows/build-wheels.yaml | 54 ++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 02a1aac..c897975 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -28,33 +28,33 @@ jobs: # cibw_archs: "x86_64" # - os: macos-14 # cibw_archs: "arm64" - env: - # CIBW_BEFORE_BUILD: >- - # rm -rf {package}/build - CIBW_BEFORE_BUILD_WINDOWS: >- - pip install delvewheel - CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- - delvewheel repair -w {dest_dir} {wheel} - # TODO: switch to building based on locked src - # and use tests-min-locked here - CIBW_TEST_EXTRAS: >- - tests-min - CIBW_TEST_COMMAND: >- - pytest {project}/tests - # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have - # # MinGW on PATH that would be picked otherwise), switch to a static build for - # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, - # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while - # # keeping shared state with the rest of the Python process/extensions. - # CIBW_CONFIG_SETTINGS_WINDOWS: >- - # setup-args="--vsenv" - # setup-args="-Db_vscrt=mt" - # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" - # CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - # CIBW_SKIP: "*-musllinux_aarch64" - # CIBW_TEST_COMMAND: >- - # python {package}/ci/check_version_number.py - # MACOSX_DEPLOYMENT_TARGET: "10.12" + env: + # CIBW_BEFORE_BUILD: >- + # rm -rf {package}/build + CIBW_BEFORE_BUILD_WINDOWS: >- + pip install delvewheel + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- + delvewheel repair -w {dest_dir} {wheel} + # TODO: switch to building based on locked src + # and use tests-min-locked here + CIBW_TEST_EXTRAS: >- + tests-min + CIBW_TEST_COMMAND: >- + pytest {project}/tests + # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have + # # MinGW on PATH that would be picked otherwise), switch to a static build for + # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, + # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while + # # keeping shared state with the rest of the Python process/extensions. + # CIBW_CONFIG_SETTINGS_WINDOWS: >- + # setup-args="--vsenv" + # setup-args="-Db_vscrt=mt" + # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" + # CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + # CIBW_SKIP: "*-musllinux_aarch64" + # CIBW_TEST_COMMAND: >- + # python {package}/ci/check_version_number.py + # MACOSX_DEPLOYMENT_TARGET: "10.12" steps: - uses: actions/checkout@v5 From 9e7430b54ba033930f6141805f6859082679b8b1 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:20:52 +0200 Subject: [PATCH 03/46] Try and figure out erro --- .github/workflows/build-wheels.yaml | 242 ++++++++++++++-------------- 1 file changed, 120 insertions(+), 122 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index c897975..e306c44 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -12,22 +12,6 @@ jobs: build_wheels: name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - # - os: ubuntu-latest - # cibw_archs: "x86_64" - # - os: ubuntu-24.04-arm - # cibw_archs: "aarch64" - - os: windows-latest - cibw_archs: "AMD64" - - os: windows-11-arm - cibw_archs: "ARM64" - # - os: macos-13 - # cibw_archs: "x86_64" - # - os: macos-14 - # cibw_archs: "arm64" env: # CIBW_BEFORE_BUILD: >- # rm -rf {package}/build @@ -55,117 +39,131 @@ jobs: # CIBW_TEST_COMMAND: >- # python {package}/ci/check_version_number.py # MACOSX_DEPLOYMENT_TARGET: "10.12" + strategy: + fail-fast: false + matrix: + include: + # - os: ubuntu-latest + # cibw_archs: "x86_64" + # - os: ubuntu-24.04-arm + # cibw_archs: "aarch64" + - os: windows-latest + cibw_archs: "AMD64" + - os: windows-11-arm + cibw_archs: "ARM64" + # - os: macos-13 + # cibw_archs: "x86_64" + # - os: macos-14 + # cibw_archs: "arm64" steps: - uses: actions/checkout@v5 - - - name: Build wheels for CPython 3.12 - uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 - with: - package-dir: . - output-dir: wheelhouse - config-file: "{package}/pyproject.toml" - env: - CIBW_BUILD: "cp312-*" - CIBW_ARCHS: ${{ matrix.cibw_archs }} - - # - name: Setup Python - # if: ${{ startsWith(matrix.os, 'windows') }} - # uses: actions/setup-python@v5 - # with: - # python-version: '3.x' - # - # # Maybe not necessary, source: - # # https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/ - # # and - # # https://github.com/numpy/numpy/blob/71eebaf8513dfd6ed40b0c689702d81e3f6f2527/.github/workflows/wheels.yml#L123 - # - name: Setup MSVC developer shell (32-bit) - # if: ${{ matrix.os == 'windows-2022' }} - # uses: bus1/cabuild/action/msdevshell@v1 - # with: - # architecture: x64 - # - # - name: Install Fortran compiler - # # When building from source, ensure we have a Fortran compiler - # if: ${{ startsWith(matrix.os, 'macos') }} - # uses: fortran-lang/setup-fortran@v1 - # id: setup-fortran - # with: - # # TODO: figure out whether we need/want to use other compilers too - # compiler: "gcc" - # version: "13" - # - # - name: Set macOS-13 specific flags - # if: matrix.os == 'macos-13' - # run: | - # echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> "$GITHUB_ENV" - # - # - name: Set macOS-14 specific flags - # if: matrix.os == 'macos-14' - # run: | - # echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV" - # - # - name: Build wheels - # uses: pypa/cibuildwheel@v3.1.4 - # # env: - # # CIBW_SOME_OPTION: value - # # ... - # with: - # package-dir: . - # output-dir: wheelhouse - # config-file: "{package}/pyproject.toml" - - - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} - path: ./wheelhouse/*.whl - if-no-files-found: error - - # make-sdist: - # name: Make source distribution - # runs-on: "ubuntu-latest" - # - # steps: - # - name: Check out repository - # uses: actions/checkout@v4 + # - name: Build wheels for CPython 3.12 + # uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 # with: - # fetch-depth: 0 - # - # - uses: ./.github/actions/setup + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + # env: + # CIBW_BUILD: "cp312-*" + # CIBW_ARCHS: ${{ matrix.cibw_archs }} + # # - name: Setup Python + # # if: ${{ startsWith(matrix.os, 'windows') }} + # # uses: actions/setup-python@v5 + # # with: + # # python-version: '3.x' + # # + # # # Maybe not necessary, source: + # # # https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/ + # # # and + # # # https://github.com/numpy/numpy/blob/71eebaf8513dfd6ed40b0c689702d81e3f6f2527/.github/workflows/wheels.yml#L123 + # # - name: Setup MSVC developer shell (32-bit) + # # if: ${{ matrix.os == 'windows-2022' }} + # # uses: bus1/cabuild/action/msdevshell@v1 + # # with: + # # architecture: x64 + # # + # # - name: Install Fortran compiler + # # # When building from source, ensure we have a Fortran compiler + # # if: ${{ startsWith(matrix.os, 'macos') }} + # # uses: fortran-lang/setup-fortran@v1 + # # id: setup-fortran + # # with: + # # # TODO: figure out whether we need/want to use other compilers too + # # compiler: "gcc" + # # version: "13" + # # + # # - name: Set macOS-13 specific flags + # # if: matrix.os == 'macos-13' + # # run: | + # # echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> "$GITHUB_ENV" + # # + # # - name: Set macOS-14 specific flags + # # if: matrix.os == 'macos-14' + # # run: | + # # echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV" + # # + # # - name: Build wheels + # # uses: pypa/cibuildwheel@v3.1.4 + # # # env: + # # # CIBW_SOME_OPTION: value + # # # ... + # # with: + # # package-dir: . + # # output-dir: wheelhouse + # # config-file: "{package}/pyproject.toml" + # - name: Upload wheels + # uses: actions/upload-artifact@v4 # with: - # python-version: ${{ matrix.python-version }} - # uv-dependency-install-flags: "--all-extras --group dev" + # name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} + # path: ./wheelhouse/*.whl + # if-no-files-found: error # - # - name: Create source distribution - # run: uv build --sdist + # # make-sdist: + # # name: Make source distribution + # # runs-on: "ubuntu-latest" + # # + # # steps: + # # - name: Check out repository + # # uses: actions/checkout@v4 + # # with: + # # fetch-depth: 0 + # # + # # - uses: ./.github/actions/setup + # # with: + # # python-version: ${{ matrix.python-version }} + # # uv-dependency-install-flags: "--all-extras --group dev" + # # + # # - name: Create source distribution + # # run: uv build --sdist + # # + # # - name: Upload the source distribution artefact + # # uses: actions/upload-artifact@v4 + # # with: + # # name: cibw-sdist + # # path: dist/*.tar.gz # - # - name: Upload the source distribution artefact - # uses: actions/upload-artifact@v4 + # deploy-pypi: + # # TODO: turn back on + # # needs: [ build-wheels, make-sdist ] + # needs: [build-wheels] + # # Having an environment for deployment is strongly recommend by PyPI + # # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions + # # You can comment this line out if you don't want it. + # # # TODO: turn back on when we only run this on main + # # environment: deploy + # # permissions: + # # # this permission is mandatory for trusted publishing with PyPI + # # id-token: write + # runs-on: ubuntu-latest + # steps: + # - name: Download artefacts + # uses: actions/download-artifact@v5 # with: - # name: cibw-sdist - # path: dist/*.tar.gz - - deploy-pypi: - # TODO: turn back on - # needs: [ build-wheels, make-sdist ] - needs: [build-wheels] - # Having an environment for deployment is strongly recommend by PyPI - # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions - # You can comment this line out if you don't want it. - # # TODO: turn back on when we only run this on main - # environment: deploy - # permissions: - # # this permission is mandatory for trusted publishing with PyPI - # id-token: write - runs-on: ubuntu-latest - steps: - - name: Download artefacts - uses: actions/download-artifact@v5 - with: - pattern: cibw-* - path: dist - merge-multiple: true - - name: Publish to PyPI - run: | - ls dist - # uv publish + # pattern: cibw-* + # path: dist + # merge-multiple: true + # - name: Publish to PyPI + # run: | + # ls dist + # # uv publish From 811a58300ca6ce247afedaa54a332b017e61e58a Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:21:50 +0200 Subject: [PATCH 04/46] Try and fix up error 2 --- .github/workflows/build-wheels.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index e306c44..de2b9b8 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -58,15 +58,15 @@ jobs: steps: - uses: actions/checkout@v5 - # - name: Build wheels for CPython 3.12 - # uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 - # with: - # package-dir: . - # output-dir: wheelhouse - # config-file: "{package}/pyproject.toml" - # env: - # CIBW_BUILD: "cp312-*" - # CIBW_ARCHS: ${{ matrix.cibw_archs }} + - name: Build wheels for CPython 3.12 + uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 + with: + package-dir: . + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + env: + CIBW_BUILD: "cp312-*" + CIBW_ARCHS: ${{ matrix.cibw_archs }} # # - name: Setup Python # # if: ${{ startsWith(matrix.os, 'windows') }} # # uses: actions/setup-python@v5 From 42662844cc1b574b5cc8754c5503aab1ee530875 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:27:27 +0200 Subject: [PATCH 05/46] Fix up pytest installation --- .github/workflows/build-wheels.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index de2b9b8..ec8cf09 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -21,8 +21,8 @@ jobs: delvewheel repair -w {dest_dir} {wheel} # TODO: switch to building based on locked src # and use tests-min-locked here - CIBW_TEST_EXTRAS: >- - tests-min + CIBW_BEFORE_TEST: >- + pip install -r {project}/requirements-only-tests-min-locked.txt CIBW_TEST_COMMAND: >- pytest {project}/tests # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have From af0222caba5db9d388a6ebfcf213480ffe28b0d8 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:46:55 +0200 Subject: [PATCH 06/46] Try python 3.9 --- .github/workflows/build-wheels.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index ec8cf09..579a502 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -58,6 +58,15 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Build wheels for CPython 3.9 + uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 + with: + package-dir: . + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + env: + CIBW_BUILD: "cp39-*" + CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.12 uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: From 75de419902da0d56b3bba2ec23012ca9cad9bb3a Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:48:13 +0200 Subject: [PATCH 07/46] Turn upload back on --- .github/workflows/build-wheels.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 579a502..4d75d55 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -121,12 +121,12 @@ jobs: # # package-dir: . # # output-dir: wheelhouse # # config-file: "{package}/pyproject.toml" - # - name: Upload wheels - # uses: actions/upload-artifact@v4 - # with: - # name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} - # path: ./wheelhouse/*.whl - # if-no-files-found: error + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} + path: ./wheelhouse/*.whl + if-no-files-found: error # # # make-sdist: # # name: Make source distribution From 15e6fe5a24a6735c99e65e520da21514aa93b044 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:48:40 +0200 Subject: [PATCH 08/46] Turn deploy back on --- .github/workflows/build-wheels.yaml | 92 ++++++++++++++--------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 4d75d55..e85ede5 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -127,52 +127,52 @@ jobs: name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} path: ./wheelhouse/*.whl if-no-files-found: error + + # make-sdist: + # name: Make source distribution + # runs-on: "ubuntu-latest" # - # # make-sdist: - # # name: Make source distribution - # # runs-on: "ubuntu-latest" - # # - # # steps: - # # - name: Check out repository - # # uses: actions/checkout@v4 - # # with: - # # fetch-depth: 0 - # # - # # - uses: ./.github/actions/setup - # # with: - # # python-version: ${{ matrix.python-version }} - # # uv-dependency-install-flags: "--all-extras --group dev" - # # - # # - name: Create source distribution - # # run: uv build --sdist - # # - # # - name: Upload the source distribution artefact - # # uses: actions/upload-artifact@v4 - # # with: - # # name: cibw-sdist - # # path: dist/*.tar.gz - # - # deploy-pypi: - # # TODO: turn back on - # # needs: [ build-wheels, make-sdist ] - # needs: [build-wheels] - # # Having an environment for deployment is strongly recommend by PyPI - # # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions - # # You can comment this line out if you don't want it. - # # # TODO: turn back on when we only run this on main - # # environment: deploy - # # permissions: - # # # this permission is mandatory for trusted publishing with PyPI - # # id-token: write - # runs-on: ubuntu-latest # steps: - # - name: Download artefacts - # uses: actions/download-artifact@v5 + # - name: Check out repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # + # - uses: ./.github/actions/setup + # with: + # python-version: ${{ matrix.python-version }} + # uv-dependency-install-flags: "--all-extras --group dev" + # + # - name: Create source distribution + # run: uv build --sdist + # + # - name: Upload the source distribution artefact + # uses: actions/upload-artifact@v4 # with: - # pattern: cibw-* - # path: dist - # merge-multiple: true - # - name: Publish to PyPI - # run: | - # ls dist - # # uv publish + # name: cibw-sdist + # path: dist/*.tar.gz + + deploy-pypi: + # TODO: turn back on + # needs: [ build-wheels, make-sdist ] + needs: [build-wheels] + # Having an environment for deployment is strongly recommend by PyPI + # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions + # You can comment this line out if you don't want it. + # # TODO: turn back on when we only run this on main + # environment: deploy + # permissions: + # # this permission is mandatory for trusted publishing with PyPI + # id-token: write + runs-on: ubuntu-latest + steps: + - name: Download artefacts + uses: actions/download-artifact@v5 + with: + pattern: cibw-* + path: dist + merge-multiple: true + - name: Publish to PyPI + run: | + ls dist + # uv publish From 95e854df4787095d0dac568e9628242dfa5cba25 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:49:33 +0200 Subject: [PATCH 09/46] FIx up needs --- .github/workflows/build-wheels.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index e85ede5..2b582ab 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -9,7 +9,7 @@ name: Build on: [push] jobs: - build_wheels: + build-wheels: name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} runs-on: ${{ matrix.os }} env: From 72ac20069e7336b9b3ecabe4738bb3585c4ff96e Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 08:54:39 +0200 Subject: [PATCH 10/46] Try building wheels for all python on AMD and better overrides on ARM --- .github/workflows/build-wheels.yaml | 14 ++++++++++++++ pyproject.toml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 2b582ab..942b549 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -58,7 +58,19 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Build wheels + # TODO: remove + if: matrix.cibw_archs == 'AMD64' + uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 + with: + package-dir: . + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + env: + CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.9 + # TODO: remove + if: matrix.cibw_archs == 'ARM64' uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: package-dir: . @@ -68,6 +80,8 @@ jobs: CIBW_BUILD: "cp39-*" CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.12 + # TODO: remove + if: matrix.cibw_archs == 'ARM64' uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: package-dir: . diff --git a/pyproject.toml b/pyproject.toml index e575b47..db3f671 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -143,7 +143,7 @@ install = [ # FIXME: Remove this override once dependencies are available on PyPI. [[tool.cibuildwheel.overrides]] select = "*-win_arm64" -before-test = """\ +before-build = """\ pip install --pre \ --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ numpy""" From ad4ad704409ee648359c8e92202429377ea232ea Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:02:02 +0200 Subject: [PATCH 11/46] Shuffle round numpy build --- .github/workflows/build-wheels.yaml | 2 ++ pyproject.toml | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 942b549..7bb5f90 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -79,6 +79,8 @@ jobs: env: CIBW_BUILD: "cp39-*" CIBW_ARCHS: ${{ matrix.cibw_archs }} + # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 + CIBW_BEFORE_BUILD: pip install --pre --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy --only-binary numpy - name: Build wheels for CPython 3.12 # TODO: remove if: matrix.cibw_archs == 'ARM64' diff --git a/pyproject.toml b/pyproject.toml index db3f671..0b402bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,15 +139,6 @@ install = [ '--skip-subprojects', ] -# See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 -# FIXME: Remove this override once dependencies are available on PyPI. -[[tool.cibuildwheel.overrides]] -select = "*-win_arm64" -before-build = """\ - pip install --pre \ - --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ - numpy""" - [tool.coverage.run] source = [ "src", From 7cf67604e64c149caaa30d0ccd1f30acbe1e1d14 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:08:32 +0200 Subject: [PATCH 12/46] Try to fix build install --- .github/workflows/build-wheels.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 7bb5f90..17efb54 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -47,8 +47,8 @@ jobs: # cibw_archs: "x86_64" # - os: ubuntu-24.04-arm # cibw_archs: "aarch64" - - os: windows-latest - cibw_archs: "AMD64" + # - os: windows-latest + # cibw_archs: "AMD64" - os: windows-11-arm cibw_archs: "ARM64" # - os: macos-13 @@ -80,7 +80,9 @@ jobs: CIBW_BUILD: "cp39-*" CIBW_ARCHS: ${{ matrix.cibw_archs }} # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 - CIBW_BEFORE_BUILD: pip install --pre --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy --only-binary numpy + CIBW_BEFORE_BUILD_WINDOWS: >- + pip install delvewheel + && pip install --pre --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy --only-binary numpy - name: Build wheels for CPython 3.12 # TODO: remove if: matrix.cibw_archs == 'ARM64' @@ -92,6 +94,9 @@ jobs: env: CIBW_BUILD: "cp312-*" CIBW_ARCHS: ${{ matrix.cibw_archs }} + CIBW_BEFORE_BUILD_WINDOWS: >- + pip install delvewheel + && pip install numpy # # - name: Setup Python # # if: ${{ startsWith(matrix.os, 'windows') }} # # uses: actions/setup-python@v5 From 007ff7cf3abcdda7b0f758819c0453db9acceb3c Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:11:12 +0200 Subject: [PATCH 13/46] Switch around numpy install --- .github/workflows/build-wheels.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 17efb54..aa40dbe 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -82,7 +82,7 @@ jobs: # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 CIBW_BEFORE_BUILD_WINDOWS: >- pip install delvewheel - && pip install --pre --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy --only-binary numpy + && pip install numpy - name: Build wheels for CPython 3.12 # TODO: remove if: matrix.cibw_archs == 'ARM64' @@ -96,7 +96,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} CIBW_BEFORE_BUILD_WINDOWS: >- pip install delvewheel - && pip install numpy + && pip install --pre --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy --only-binary numpy # # - name: Setup Python # # if: ${{ startsWith(matrix.os, 'windows') }} # # uses: actions/setup-python@v5 From ecf5a80bc1a4d25e41a500426551aa1ed9f2866f Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:17:33 +0200 Subject: [PATCH 14/46] Try 3.10 instead --- .github/workflows/build-wheels.yaml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index aa40dbe..1dc945d 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -68,7 +68,23 @@ jobs: config-file: "{package}/pyproject.toml" env: CIBW_ARCHS: ${{ matrix.cibw_archs }} - - name: Build wheels for CPython 3.9 + # # Seems to not be happy because you can't get numpy to install + # - name: Build wheels for CPython 3.9 + # # TODO: remove + # if: matrix.cibw_archs == 'ARM64' + # uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + # env: + # CIBW_BUILD: "cp39-*" + # CIBW_ARCHS: ${{ matrix.cibw_archs }} + # # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 + # CIBW_BEFORE_BUILD_WINDOWS: >- + # pip install delvewheel + # && pip install numpy + - name: Build wheels for CPython 3.10 # TODO: remove if: matrix.cibw_archs == 'ARM64' uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 @@ -77,7 +93,7 @@ jobs: output-dir: wheelhouse config-file: "{package}/pyproject.toml" env: - CIBW_BUILD: "cp39-*" + CIBW_BUILD: "cp310-*" CIBW_ARCHS: ${{ matrix.cibw_archs }} # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 CIBW_BEFORE_BUILD_WINDOWS: >- From a82da08fcb52d3fb5fb9ea8330ff6fd9253115f3 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:21:46 +0200 Subject: [PATCH 15/46] Try and be smarter --- .github/workflows/build-wheels.yaml | 36 ++++------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 1dc945d..b0e8a00 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -68,23 +68,7 @@ jobs: config-file: "{package}/pyproject.toml" env: CIBW_ARCHS: ${{ matrix.cibw_archs }} - # # Seems to not be happy because you can't get numpy to install - # - name: Build wheels for CPython 3.9 - # # TODO: remove - # if: matrix.cibw_archs == 'ARM64' - # uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 - # with: - # package-dir: . - # output-dir: wheelhouse - # config-file: "{package}/pyproject.toml" - # env: - # CIBW_BUILD: "cp39-*" - # CIBW_ARCHS: ${{ matrix.cibw_archs }} - # # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 - # CIBW_BEFORE_BUILD_WINDOWS: >- - # pip install delvewheel - # && pip install numpy - - name: Build wheels for CPython 3.10 + - name: Build wheels # TODO: remove if: matrix.cibw_archs == 'ARM64' uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 @@ -93,26 +77,14 @@ jobs: output-dir: wheelhouse config-file: "{package}/pyproject.toml" env: - CIBW_BUILD: "cp310-*" + # 3.9, 3.10 seem to not be happy because you can't install numpy from a wheel + # (and we're not going to try recompiling) + CIBW_SKIP: "cp39-win_arm64 cp310-win_arm64" CIBW_ARCHS: ${{ matrix.cibw_archs }} # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 CIBW_BEFORE_BUILD_WINDOWS: >- pip install delvewheel && pip install numpy - - name: Build wheels for CPython 3.12 - # TODO: remove - if: matrix.cibw_archs == 'ARM64' - uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 - with: - package-dir: . - output-dir: wheelhouse - config-file: "{package}/pyproject.toml" - env: - CIBW_BUILD: "cp312-*" - CIBW_ARCHS: ${{ matrix.cibw_archs }} - CIBW_BEFORE_BUILD_WINDOWS: >- - pip install delvewheel - && pip install --pre --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy --only-binary numpy # # - name: Setup Python # # if: ${{ startsWith(matrix.os, 'windows') }} # # uses: actions/setup-python@v5 From faa69de5145a8fcd0abc0131684067ba05c907d2 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:51:53 +0200 Subject: [PATCH 16/46] Clean up and try using matplotlib vscode magic --- .github/workflows/build-wheels.yaml | 61 ++++++++++++----------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index b0e8a00..b6ba4b9 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -13,8 +13,12 @@ jobs: name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} runs-on: ${{ matrix.os }} env: - # CIBW_BEFORE_BUILD: >- - # rm -rf {package}/build + # 3.9, 3.10 seem to not be happy on windows arm64 + # because you can't install numpy from a wheel for the build environment + # (and we're not going to try recompiling from source) + CIBW_SKIP: "cp39-win_arm64 cp310-win_arm64" + # TODO: consider turning this on + # CIBW_ENABLE: cpython-freethreading CIBW_BEFORE_BUILD_WINDOWS: >- pip install delvewheel CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- @@ -25,36 +29,32 @@ jobs: pip install -r {project}/requirements-only-tests-min-locked.txt CIBW_TEST_COMMAND: >- pytest {project}/tests - # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have - # # MinGW on PATH that would be picked otherwise), switch to a static build for - # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, - # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while - # # keeping shared state with the rest of the Python process/extensions. - # CIBW_CONFIG_SETTINGS_WINDOWS: >- - # setup-args="--vsenv" - # setup-args="-Db_vscrt=mt" - # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" - # CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - # CIBW_SKIP: "*-musllinux_aarch64" - # CIBW_TEST_COMMAND: >- - # python {package}/ci/check_version_number.py - # MACOSX_DEPLOYMENT_TARGET: "10.12" + MACOSX_DEPLOYMENT_TARGET: "10.12" + # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have + # MinGW on PATH that would be picked otherwise), switch to a static build for + # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, + # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while + # keeping shared state with the rest of the Python process/extensions. + CIBW_CONFIG_SETTINGS_WINDOWS: >- + setup-args="--vsenv" + setup-args="-Db_vscrt=mt" + setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" strategy: fail-fast: false matrix: include: - # - os: ubuntu-latest - # cibw_archs: "x86_64" - # - os: ubuntu-24.04-arm - # cibw_archs: "aarch64" - # - os: windows-latest - # cibw_archs: "AMD64" + - os: ubuntu-latest + cibw_archs: "x86_64" + - os: ubuntu-24.04-arm + cibw_archs: "aarch64" + - os: windows-latest + cibw_archs: "AMD64" - os: windows-11-arm cibw_archs: "ARM64" - # - os: macos-13 - # cibw_archs: "x86_64" - # - os: macos-14 - # cibw_archs: "arm64" + - os: macos-13 + cibw_archs: "x86_64" + - os: macos-14 + cibw_archs: "arm64" steps: - uses: actions/checkout@v5 @@ -69,22 +69,13 @@ jobs: env: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels - # TODO: remove - if: matrix.cibw_archs == 'ARM64' uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: package-dir: . output-dir: wheelhouse config-file: "{package}/pyproject.toml" env: - # 3.9, 3.10 seem to not be happy because you can't install numpy from a wheel - # (and we're not going to try recompiling) - CIBW_SKIP: "cp39-win_arm64 cp310-win_arm64" CIBW_ARCHS: ${{ matrix.cibw_archs }} - # See: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/pyproject.toml#L89C1-L95C23 - CIBW_BEFORE_BUILD_WINDOWS: >- - pip install delvewheel - && pip install numpy # # - name: Setup Python # # if: ${{ startsWith(matrix.os, 'windows') }} # # uses: actions/setup-python@v5 From 3dbdb139d2b8cd30b507abc35992f6d72933a7bb Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:53:45 +0200 Subject: [PATCH 17/46] Add Fortran compiler install to mac builds --- .github/workflows/build-wheels.yaml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index b6ba4b9..cf0ddf3 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -58,6 +58,15 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Install Fortran compiler + # When building on Mac, we need to have a Fortran compiler + if: ${{ startsWith(matrix.os, 'macos') }} + uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + # TODO: figure out whether we need/want to use other compilers too + compiler: "gcc" + version: "13" - name: Build wheels # TODO: remove if: matrix.cibw_archs == 'AMD64' @@ -92,16 +101,6 @@ jobs: # # with: # # architecture: x64 # # - # # - name: Install Fortran compiler - # # # When building from source, ensure we have a Fortran compiler - # # if: ${{ startsWith(matrix.os, 'macos') }} - # # uses: fortran-lang/setup-fortran@v1 - # # id: setup-fortran - # # with: - # # # TODO: figure out whether we need/want to use other compilers too - # # compiler: "gcc" - # # version: "13" - # # # # - name: Set macOS-13 specific flags # # if: matrix.os == 'macos-13' # # run: | From ea621d611d19901321e455af99aecb21792b0d28 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 09:57:58 +0200 Subject: [PATCH 18/46] Deactivate windows trickery --- .github/workflows/build-wheels.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index cf0ddf3..77c7e40 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -30,15 +30,15 @@ jobs: CIBW_TEST_COMMAND: >- pytest {project}/tests MACOSX_DEPLOYMENT_TARGET: "10.12" - # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have - # MinGW on PATH that would be picked otherwise), switch to a static build for - # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, - # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while - # keeping shared state with the rest of the Python process/extensions. - CIBW_CONFIG_SETTINGS_WINDOWS: >- - setup-args="--vsenv" - setup-args="-Db_vscrt=mt" - setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" + # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have + # # MinGW on PATH that would be picked otherwise), switch to a static build for + # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, + # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while + # # keeping shared state with the rest of the Python process/extensions. + # CIBW_CONFIG_SETTINGS_WINDOWS: >- + # setup-args="--vsenv" + # setup-args="-Db_vscrt=mt" + # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" strategy: fail-fast: false matrix: From 77bc0b4e76d8db7003a206a3ee25c100584bc9aa Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:07:13 +0200 Subject: [PATCH 19/46] Try another thing --- .github/workflows/build-wheels.yaml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 77c7e40..3e74176 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -58,7 +58,7 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Install Fortran compiler + - name: Install Fortran compiler - MacOS # When building on Mac, we need to have a Fortran compiler if: ${{ startsWith(matrix.os, 'macos') }} uses: fortran-lang/setup-fortran@v1 @@ -67,16 +67,21 @@ jobs: # TODO: figure out whether we need/want to use other compilers too compiler: "gcc" version: "13" - - name: Build wheels - # TODO: remove - if: matrix.cibw_archs == 'AMD64' - uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 + - name: Specify MSVC toolchain - windows-arm + # When building on windows ARM, we need to use the MSVC toolchain + run: | + echo 'CIBW_CONFIG_SETTINGS_WINDOWS=setup-args="--vsenv" setup-args="-Db_vscrt=mt"' >> $GITHUB_ENV + # TODO: figure out escaping and add back in (?) + # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" + - name: Install Fortran compiler - windows-arm + # When building on windows ARM, we need to use the MSVC toolchain + if: ${{ matrix.os == 'windows-11-arm' }} + uses: fortran-lang/setup-fortran@v1 + id: setup-fortran with: - package-dir: . - output-dir: wheelhouse - config-file: "{package}/pyproject.toml" - env: - CIBW_ARCHS: ${{ matrix.cibw_archs }} + # TODO: figure out whether we need/want to use other compilers too + compiler: "intel" + version: "2025.0" - name: Build wheels uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: From 427dae2de4246cfeb38a26bcc5635f30e6a92b25 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:07:43 +0200 Subject: [PATCH 20/46] Fix up IDs --- .github/workflows/build-wheels.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 3e74176..24f649b 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -62,7 +62,7 @@ jobs: # When building on Mac, we need to have a Fortran compiler if: ${{ startsWith(matrix.os, 'macos') }} uses: fortran-lang/setup-fortran@v1 - id: setup-fortran + id: setup-fortran-macos with: # TODO: figure out whether we need/want to use other compilers too compiler: "gcc" @@ -77,7 +77,7 @@ jobs: # When building on windows ARM, we need to use the MSVC toolchain if: ${{ matrix.os == 'windows-11-arm' }} uses: fortran-lang/setup-fortran@v1 - id: setup-fortran + id: setup-fortran-windows-arm with: # TODO: figure out whether we need/want to use other compilers too compiler: "intel" From 23d7b2dd0aa90b1b78de4831684d60a79cfbc6ac Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:10:25 +0200 Subject: [PATCH 21/46] Upgrade mac deployment target --- .github/workflows/build-wheels.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 24f649b..1ad89e6 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -29,7 +29,7 @@ jobs: pip install -r {project}/requirements-only-tests-min-locked.txt CIBW_TEST_COMMAND: >- pytest {project}/tests - MACOSX_DEPLOYMENT_TARGET: "10.12" + MACOSX_DEPLOYMENT_TARGET: "13.0" # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have # # MinGW on PATH that would be picked otherwise), switch to a static build for # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, From 5f32bf3fdce759ba92812c414e381d84335f67dc Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:20:22 +0200 Subject: [PATCH 22/46] Avoid moving windows-latest target --- .github/workflows/build-wheels.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 1ad89e6..1989974 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -47,7 +47,9 @@ jobs: cibw_archs: "x86_64" - os: ubuntu-24.04-arm cibw_archs: "aarch64" - - os: windows-latest + - os: windows-2025 + cibw_archs: "AMD64" + - os: windows-2022 cibw_archs: "AMD64" - os: windows-11-arm cibw_archs: "ARM64" From 64370b6079c113ef42053fa781235e2cb694787e Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:23:42 +0200 Subject: [PATCH 23/46] Switch to intel classic compilers on windows arm --- .github/workflows/build-wheels.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 1989974..fc86673 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -81,9 +81,9 @@ jobs: uses: fortran-lang/setup-fortran@v1 id: setup-fortran-windows-arm with: - # TODO: figure out whether we need/want to use other compilers too - compiler: "intel" - version: "2025.0" + # Only intel-classic supported by f2py + compiler: "intel-classic" + version: "2021.10" - name: Build wheels uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: From bbb41b029f0c9a9820b30fb5619ef5edfd2e99a4 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:27:29 +0200 Subject: [PATCH 24/46] Drop windows-2022 build --- .github/workflows/build-wheels.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index fc86673..9cf8e29 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -49,8 +49,6 @@ jobs: cibw_archs: "aarch64" - os: windows-2025 cibw_archs: "AMD64" - - os: windows-2022 - cibw_archs: "AMD64" - os: windows-11-arm cibw_archs: "ARM64" - os: macos-13 From 8b7ae160f0328f2e228cd22dc8f883d863a3e65e Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:28:05 +0200 Subject: [PATCH 25/46] Add note --- .github/workflows/build-wheels.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 9cf8e29..295696c 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -80,6 +80,7 @@ jobs: id: setup-fortran-windows-arm with: # Only intel-classic supported by f2py + # (https://numpy.org/devdocs/f2py/windows/intel.html#f2py-and-windows-intel-fortran) compiler: "intel-classic" version: "2021.10" - name: Build wheels From 9eefcd995b71e01b7480430226e066eb3321d2f0 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 10:47:51 +0200 Subject: [PATCH 26/46] Turn off windows arm build --- .github/workflows/build-wheels.yaml | 109 ++++++++++------------------ 1 file changed, 37 insertions(+), 72 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 295696c..faaf322 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -30,15 +30,6 @@ jobs: CIBW_TEST_COMMAND: >- pytest {project}/tests MACOSX_DEPLOYMENT_TARGET: "13.0" - # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have - # # MinGW on PATH that would be picked otherwise), switch to a static build for - # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, - # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while - # # keeping shared state with the rest of the Python process/extensions. - # CIBW_CONFIG_SETTINGS_WINDOWS: >- - # setup-args="--vsenv" - # setup-args="-Db_vscrt=mt" - # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" strategy: fail-fast: false matrix: @@ -49,8 +40,13 @@ jobs: cibw_archs: "aarch64" - os: windows-2025 cibw_archs: "AMD64" - - os: windows-11-arm - cibw_archs: "ARM64" + # # Not happy at the moment hence turned off + # # It doesn't seem too far away, but something isn't quite right. + # # Latest run by Zeb: https://github.com/openscm/example-fgen-basic/actions/runs/17173313157/job/48725872212 + # # Can't find numpy definitions for some reason. + # # Maybe helpful issue: https://github.com/numpy/numpy/issues/25000 + # - os: windows-11-arm + # cibw_archs: "ARM64" - os: macos-13 cibw_archs: "x86_64" - os: macos-14 @@ -69,6 +65,16 @@ jobs: version: "13" - name: Specify MSVC toolchain - windows-arm # When building on windows ARM, we need to use the MSVC toolchain + # # Original from: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/.github/workflows/cibuildwheel.yml#L108 + # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have + # # MinGW on PATH that would be picked otherwise), switch to a static build for + # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, + # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while + # # keeping shared state with the rest of the Python process/extensions. + # CIBW_CONFIG_SETTINGS_WINDOWS: >- + # setup-args="--vsenv" + # setup-args="-Db_vscrt=mt" + # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" run: | echo 'CIBW_CONFIG_SETTINGS_WINDOWS=setup-args="--vsenv" setup-args="-Db_vscrt=mt"' >> $GITHUB_ENV # TODO: figure out escaping and add back in (?) @@ -91,41 +97,6 @@ jobs: config-file: "{package}/pyproject.toml" env: CIBW_ARCHS: ${{ matrix.cibw_archs }} - # # - name: Setup Python - # # if: ${{ startsWith(matrix.os, 'windows') }} - # # uses: actions/setup-python@v5 - # # with: - # # python-version: '3.x' - # # - # # # Maybe not necessary, source: - # # # https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/ - # # # and - # # # https://github.com/numpy/numpy/blob/71eebaf8513dfd6ed40b0c689702d81e3f6f2527/.github/workflows/wheels.yml#L123 - # # - name: Setup MSVC developer shell (32-bit) - # # if: ${{ matrix.os == 'windows-2022' }} - # # uses: bus1/cabuild/action/msdevshell@v1 - # # with: - # # architecture: x64 - # # - # # - name: Set macOS-13 specific flags - # # if: matrix.os == 'macos-13' - # # run: | - # # echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> "$GITHUB_ENV" - # # - # # - name: Set macOS-14 specific flags - # # if: matrix.os == 'macos-14' - # # run: | - # # echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV" - # # - # # - name: Build wheels - # # uses: pypa/cibuildwheel@v3.1.4 - # # # env: - # # # CIBW_SOME_OPTION: value - # # # ... - # # with: - # # package-dir: . - # # output-dir: wheelhouse - # # config-file: "{package}/pyproject.toml" - name: Upload wheels uses: actions/upload-artifact@v4 with: @@ -133,34 +104,28 @@ jobs: path: ./wheelhouse/*.whl if-no-files-found: error - # make-sdist: - # name: Make source distribution - # runs-on: "ubuntu-latest" - # - # steps: - # - name: Check out repository - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # - # - uses: ./.github/actions/setup - # with: - # python-version: ${{ matrix.python-version }} - # uv-dependency-install-flags: "--all-extras --group dev" - # - # - name: Create source distribution - # run: uv build --sdist - # - # - name: Upload the source distribution artefact - # uses: actions/upload-artifact@v4 - # with: - # name: cibw-sdist - # path: dist/*.tar.gz + make-sdist: + name: Make source distribution + runs-on: "ubuntu-latest" + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: ./.github/actions/setup + with: + python-version: ${{ matrix.python-version }} + uv-dependency-install-flags: "--all-extras --group dev" + - name: Create source distribution + run: uv build --sdist + - name: Upload the source distribution artefact + uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz deploy-pypi: - # TODO: turn back on - # needs: [ build-wheels, make-sdist ] - needs: [build-wheels] + needs: [ build-wheels, make-sdist ] # Having an environment for deployment is strongly recommend by PyPI # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions # You can comment this line out if you don't want it. From 8b6e28dc9e383ed3bdeeefd0c0a861d508d9f696 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 11:09:49 +0200 Subject: [PATCH 27/46] More notes --- .github/workflows/build-wheels.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index faaf322..37fc280 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -45,6 +45,14 @@ jobs: # # Latest run by Zeb: https://github.com/openscm/example-fgen-basic/actions/runs/17173313157/job/48725872212 # # Can't find numpy definitions for some reason. # # Maybe helpful issue: https://github.com/numpy/numpy/issues/25000 + # # numpy uses different compilers, might be something to try, see: + # # - https://github.com/numpy/numpy/actions/runs/17087345049/job/48453931521 + # # - https://github.com/numpy/numpy/blob/37c9cb68ba7db9c48bc0e3354953c57a78d2b0e8/.github/workflows/wheels.yml#L129 + # # scipy doesn't bother building windows arm wheels, see: + # # - https://pypi.org/project/scipy/#files + # # potentially relevant scipy issues: + # # - https://github.com/scipy/scipy/issues/21716 + # # - https://github.com/scipy/scipy/issues/14812 # - os: windows-11-arm # cibw_archs: "ARM64" - os: macos-13 From 57cd397780a64d3dcc29d8da5746dc642d917c68 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 11:24:47 +0200 Subject: [PATCH 28/46] Fix name --- .github/workflows/build-wheels.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index 37fc280..fdf628c 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -1,4 +1,4 @@ -name: Build +name: Build wheels # Current draft based on # https://github.com/matplotlib/matplotlib/blob/main/.github/workflows/cibuildwheel.yml From ad7e694615618941890948a0ec16a2e19e627de0 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Sat, 23 Aug 2025 11:25:18 +0200 Subject: [PATCH 29/46] Add TODO --- .github/workflows/build-wheels.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index fdf628c..a505481 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -1,8 +1,6 @@ name: Build wheels -# Current draft based on -# https://github.com/matplotlib/matplotlib/blob/main/.github/workflows/cibuildwheel.yml -# TODO: only run on published releases +# TODO: move into the release-deploy workflow and only run on published releases # on: # release: # types: [published] From 6ed895fdcd5b62a9d444f5784164f025783ae30e Mon Sep 17 00:00:00 2001 From: Marco Zecchetto Date: Mon, 25 Aug 2025 17:50:49 +0200 Subject: [PATCH 30/46] Added build wheels on windows ARM --- .github/workflows/build-wheels.yaml | 69 +++++++++++++++++++---------- meson.build | 35 ++++++++++----- 2 files changed, 70 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index a505481..bab3d5e 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -1,5 +1,4 @@ name: Build wheels - # TODO: move into the release-deploy workflow and only run on published releases # on: # release: @@ -32,12 +31,12 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest - cibw_archs: "x86_64" - - os: ubuntu-24.04-arm - cibw_archs: "aarch64" - - os: windows-2025 - cibw_archs: "AMD64" + #- os: ubuntu-latest + # cibw_archs: "x86_64" + #- os: ubuntu-24.04-arm + # cibw_archs: "aarch64" + #- os: windows-2025 + # cibw_archs: "AMD64" # # Not happy at the moment hence turned off # # It doesn't seem too far away, but something isn't quite right. # # Latest run by Zeb: https://github.com/openscm/example-fgen-basic/actions/runs/17173313157/job/48725872212 @@ -51,12 +50,12 @@ jobs: # # potentially relevant scipy issues: # # - https://github.com/scipy/scipy/issues/21716 # # - https://github.com/scipy/scipy/issues/14812 - # - os: windows-11-arm - # cibw_archs: "ARM64" - - os: macos-13 - cibw_archs: "x86_64" - - os: macos-14 - cibw_archs: "arm64" + - os: windows-11-arm + cibw_archs: "ARM64" + #- os: macos-13 + # cibw_archs: "x86_64" + #- os: macos-14 + # cibw_archs: "arm64" steps: - uses: actions/checkout@v5 @@ -81,20 +80,44 @@ jobs: # setup-args="--vsenv" # setup-args="-Db_vscrt=mt" # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" - run: | - echo 'CIBW_CONFIG_SETTINGS_WINDOWS=setup-args="--vsenv" setup-args="-Db_vscrt=mt"' >> $GITHUB_ENV + # run: | + # echo 'CIBW_CONFIG_SETTINGS_WINDOWS=setup-args="--vsenv" setup-args="-Db_vscrt=mt"' >> $GITHUB_ENV # TODO: figure out escaping and add back in (?) # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" - - name: Install Fortran compiler - windows-arm - # When building on windows ARM, we need to use the MSVC toolchain + #### if: ${{ matrix.os == 'windows-11-arm' }} - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran-windows-arm - with: + shell: pwsh + run: | + echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "FC=flang-new" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "AR=llvm-lib.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -OutFile LLVM-woa64.exe + Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait + echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + $env:PATH = "C:\Program Files\LLVM\bin;" + $env:PATH + + # $env:VCPKG_ROOT = "C:\vcpkg" + #git clone https://github.com/microsoft/vcpkg $env:VCPKG_ROOT + #& "$env:VCPKG_ROOT\bootstrap-vcpkg.bat" + #& "$env:VCPKG_ROOT\vcpkg.exe" install pkgconf:arm64-windows + #$pkgconfPath = "$env:VCPKG_ROOT\installed\arm64-windows\tools\pkgconf" + #Copy-Item "$pkgconfPath\pkgconf.exe" "$pkgconfPath\pkg-config.exe" -Force + #echo "$pkgconfPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + ##### + #- name: Install Fortran compiler - windows-arm + # When building on windows ARM, we need to use the MSVC toolchain + #if: ${{ matrix.os == 'windows-11-arm' }} + #uses: fortran-lang/setup-fortran@v1 + #id: setup-fortran-windows-arm + #with: # Only intel-classic supported by f2py - # (https://numpy.org/devdocs/f2py/windows/intel.html#f2py-and-windows-intel-fortran) - compiler: "intel-classic" - version: "2021.10" + # # (https://numpy.org/devdocs/f2py/windows/intel.html#f2py-and-windows-intel-fortran) + # compiler: "intel-classic" + #version: "2021.10" + - name: Build wheels uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: diff --git a/meson.build b/meson.build index 82c4120..9c5e655 100644 --- a/meson.build +++ b/meson.build @@ -68,17 +68,30 @@ if pyprojectwheelbuild_enabled 'src/example_fgen_basic/runtime_helpers.py', ) - # The ancillary library, - # i.e. all the stuff for wrapping that isn't directly exposed to Python. - ancillary_lib = library( - '@0@-ancillary'.format(meson.project_name()), - sources: srcs_ancillary_lib, - version: meson.project_version(), - dependencies: [], - # any other dependencies which aren't in source e.g. fgen-core - # e.g. dependencies: [fgen_core_dep], - install: false, - ) + if host_machine.system() == 'windows' + meson.override_find_program('ar', find_program('llvm-lib', required: true)) + # also tell Meson to use MSVC-compatible static library + ancillary_lib = library( + '@0@-ancillary'.format(meson.project_name()), + sources: srcs_ancillary_lib, + version: meson.project_version(), + dependencies: [], + install: false, + override_options: ['b_vscrt=md', 'default_library=static', 'vs_library_format=lib'] + ) + else + # The ancillary library, + # i.e. all the stuff for wrapping that isn't directly exposed to Python. + ancillary_lib = library( + '@0@-ancillary'.format(meson.project_name()), + sources: srcs_ancillary_lib, + version: meson.project_version(), + dependencies: [], + # any other dependencies which aren't in source e.g. fgen-core + # e.g. dependencies: [fgen_core_dep], + install: false, + ) + endif ancillary_dep = declare_dependency(link_with: ancillary_lib) From c454a38a7fd90c4891e7aecd54e754b8c2871786 Mon Sep 17 00:00:00 2001 From: Marco Zecchetto Date: Wed, 27 Aug 2025 10:15:45 +0200 Subject: [PATCH 31/46] Clean up --- .github/workflows/build-wheels.yaml | 82 ++++++----------------------- meson.build | 26 ++++----- 2 files changed, 29 insertions(+), 79 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index bab3d5e..c65406d 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -31,31 +31,18 @@ jobs: fail-fast: false matrix: include: - #- os: ubuntu-latest - # cibw_archs: "x86_64" - #- os: ubuntu-24.04-arm - # cibw_archs: "aarch64" - #- os: windows-2025 - # cibw_archs: "AMD64" - # # Not happy at the moment hence turned off - # # It doesn't seem too far away, but something isn't quite right. - # # Latest run by Zeb: https://github.com/openscm/example-fgen-basic/actions/runs/17173313157/job/48725872212 - # # Can't find numpy definitions for some reason. - # # Maybe helpful issue: https://github.com/numpy/numpy/issues/25000 - # # numpy uses different compilers, might be something to try, see: - # # - https://github.com/numpy/numpy/actions/runs/17087345049/job/48453931521 - # # - https://github.com/numpy/numpy/blob/37c9cb68ba7db9c48bc0e3354953c57a78d2b0e8/.github/workflows/wheels.yml#L129 - # # scipy doesn't bother building windows arm wheels, see: - # # - https://pypi.org/project/scipy/#files - # # potentially relevant scipy issues: - # # - https://github.com/scipy/scipy/issues/21716 - # # - https://github.com/scipy/scipy/issues/14812 + - os: ubuntu-latest + cibw_archs: "x86_64" + - os: ubuntu-24.04-arm + cibw_archs: "aarch64" + - os: windows-2025 + cibw_archs: "AMD64" - os: windows-11-arm cibw_archs: "ARM64" - #- os: macos-13 - # cibw_archs: "x86_64" - #- os: macos-14 - # cibw_archs: "arm64" + - os: macos-13 + cibw_archs: "x86_64" + - os: macos-14 + cibw_archs: "arm64" steps: - uses: actions/checkout@v5 @@ -68,56 +55,19 @@ jobs: # TODO: figure out whether we need/want to use other compilers too compiler: "gcc" version: "13" - - name: Specify MSVC toolchain - windows-arm - # When building on windows ARM, we need to use the MSVC toolchain - # # Original from: https://github.com/matplotlib/matplotlib/blob/1ddb1eccac8cfc25dee47bc538dc5913384b253f/.github/workflows/cibuildwheel.yml#L108 - # # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have - # # MinGW on PATH that would be picked otherwise), switch to a static build for - # # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, - # # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while - # # keeping shared state with the rest of the Python process/extensions. - # CIBW_CONFIG_SETTINGS_WINDOWS: >- - # setup-args="--vsenv" - # setup-args="-Db_vscrt=mt" - # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" - # run: | - # echo 'CIBW_CONFIG_SETTINGS_WINDOWS=setup-args="--vsenv" setup-args="-Db_vscrt=mt"' >> $GITHUB_ENV - # TODO: figure out escaping and add back in (?) - # setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" - #### + - name: Specify LLVM - windows-arm if: ${{ matrix.os == 'windows-11-arm' }} shell: pwsh run: | + Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -OutFile LLVM-woa64.exe + Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait + + $env:PATH = "C:\Program Files\LLVM\bin;" + $env:PATH + echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "FC=flang-new" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "AR=llvm-lib.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -OutFile LLVM-woa64.exe - Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait - echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - $env:PATH = "C:\Program Files\LLVM\bin;" + $env:PATH - - # $env:VCPKG_ROOT = "C:\vcpkg" - #git clone https://github.com/microsoft/vcpkg $env:VCPKG_ROOT - #& "$env:VCPKG_ROOT\bootstrap-vcpkg.bat" - #& "$env:VCPKG_ROOT\vcpkg.exe" install pkgconf:arm64-windows - #$pkgconfPath = "$env:VCPKG_ROOT\installed\arm64-windows\tools\pkgconf" - #Copy-Item "$pkgconfPath\pkgconf.exe" "$pkgconfPath\pkg-config.exe" -Force - #echo "$pkgconfPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - ##### - #- name: Install Fortran compiler - windows-arm - # When building on windows ARM, we need to use the MSVC toolchain - #if: ${{ matrix.os == 'windows-11-arm' }} - #uses: fortran-lang/setup-fortran@v1 - #id: setup-fortran-windows-arm - #with: - # Only intel-classic supported by f2py - # # (https://numpy.org/devdocs/f2py/windows/intel.html#f2py-and-windows-intel-fortran) - # compiler: "intel-classic" - #version: "2021.10" - - name: Build wheels uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 with: diff --git a/meson.build b/meson.build index 9c5e655..263d605 100644 --- a/meson.build +++ b/meson.build @@ -68,21 +68,21 @@ if pyprojectwheelbuild_enabled 'src/example_fgen_basic/runtime_helpers.py', ) - if host_machine.system() == 'windows' - meson.override_find_program('ar', find_program('llvm-lib', required: true)) + #if host_machine.system() == 'windows' + # meson.override_find_program('ar', find_program('llvm-lib', required: true)) # also tell Meson to use MSVC-compatible static library - ancillary_lib = library( - '@0@-ancillary'.format(meson.project_name()), - sources: srcs_ancillary_lib, - version: meson.project_version(), - dependencies: [], - install: false, - override_options: ['b_vscrt=md', 'default_library=static', 'vs_library_format=lib'] - ) - else + # ancillary_lib = library( + # '@0@-ancillary'.format(meson.project_name()), + # sources: srcs_ancillary_lib, + # version: meson.project_version(), + # dependencies: [], + # install: false, + # override_options: ['b_vscrt=md', 'default_library=static', 'vs_library_format=lib'] + # ) + #else # The ancillary library, # i.e. all the stuff for wrapping that isn't directly exposed to Python. - ancillary_lib = library( + ancillary_lib = library( '@0@-ancillary'.format(meson.project_name()), sources: srcs_ancillary_lib, version: meson.project_version(), @@ -91,7 +91,7 @@ if pyprojectwheelbuild_enabled # e.g. dependencies: [fgen_core_dep], install: false, ) - endif + #endif ancillary_dep = declare_dependency(link_with: ancillary_lib) From 297eb5643f5ddf84274b3101117ea473d7df30e7 Mon Sep 17 00:00:00 2001 From: Marco Zecchetto Date: Wed, 27 Aug 2025 10:55:22 +0200 Subject: [PATCH 32/46] Clean up meson.build --- meson.build | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/meson.build b/meson.build index 263d605..56b3661 100644 --- a/meson.build +++ b/meson.build @@ -68,20 +68,6 @@ if pyprojectwheelbuild_enabled 'src/example_fgen_basic/runtime_helpers.py', ) - #if host_machine.system() == 'windows' - # meson.override_find_program('ar', find_program('llvm-lib', required: true)) - # also tell Meson to use MSVC-compatible static library - # ancillary_lib = library( - # '@0@-ancillary'.format(meson.project_name()), - # sources: srcs_ancillary_lib, - # version: meson.project_version(), - # dependencies: [], - # install: false, - # override_options: ['b_vscrt=md', 'default_library=static', 'vs_library_format=lib'] - # ) - #else - # The ancillary library, - # i.e. all the stuff for wrapping that isn't directly exposed to Python. ancillary_lib = library( '@0@-ancillary'.format(meson.project_name()), sources: srcs_ancillary_lib, @@ -91,7 +77,6 @@ if pyprojectwheelbuild_enabled # e.g. dependencies: [fgen_core_dep], install: false, ) - #endif ancillary_dep = declare_dependency(link_with: ancillary_lib) From f25fbdfdd49d541f8c629de4cc517ac75cc3ded5 Mon Sep 17 00:00:00 2001 From: Marco Zecchetto Date: Wed, 27 Aug 2025 10:56:11 +0200 Subject: [PATCH 33/46] Clean up meson.build --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 56b3661..93437af 100644 --- a/meson.build +++ b/meson.build @@ -68,6 +68,8 @@ if pyprojectwheelbuild_enabled 'src/example_fgen_basic/runtime_helpers.py', ) + # The ancillary library, + # i.e. all the stuff for wrapping that isn't directly exposed to Python. ancillary_lib = library( '@0@-ancillary'.format(meson.project_name()), sources: srcs_ancillary_lib, From b21169a2abe7b1e0f011d385be37f201b3a3c0b9 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:01:13 +0200 Subject: [PATCH 34/46] Add note about not building wheel in CI step --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4230068..1ed90fc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -249,6 +249,12 @@ jobs: pip install example_fgen_basic* python -c 'from example_fgen_basic.get_wavelength import get_wavelength_plain; print(get_wavelength_plain(23.4))' + # check-build-wheel + # For now, decide not to do this as odds of breaking the build are low + # (and we already implicitly test this when running the tests). + # If we find we are breaking the wheel build inadvertently often, + # we can always add this step in. + check-dependency-licences: strategy: matrix: From 88ab3f37f9cd8240d9d4f28a79ebb97743083a6b Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:04:07 +0200 Subject: [PATCH 35/46] Add test run on other OS --- .github/workflows/ci.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1ed90fc..284595d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,6 +76,19 @@ jobs: os: [ "ubuntu-latest" ] # Test against all security and bugfix versions: https://devguide.python.org/versions/ python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] + include: + # Test other OS's for a 'very stable' Python version too + - os: "windows-latest" + python-version: "3.11" + - os: "macos-latest" + python-version: "3.11" + # Include other OS for latest Python + # because these seem to be the flakiest from experience + # so are worth the extra testing + - os: "windows-latest" + python-version: "3.13" + - os: "macos-latest" + python-version: "3.13" runs-on: "${{ matrix.os }}" defaults: run: From acffdd4e5453e2060acdd183c6e77e4482c8e1fd Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:05:48 +0200 Subject: [PATCH 36/46] Add fortran setup step for macos tests --- .github/workflows/ci.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 284595d..568a95d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -100,6 +100,15 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v4 + - name: Install Fortran compiler - MacOS + # When building on Mac, we need to have a Fortran compiler + if: ${{ startsWith(matrix.os, 'macos') }} + uses: fortran-lang/setup-fortran@v1 + id: setup-fortran-macos + with: + # TODO: figure out whether we need/want to use other compilers too + compiler: "gcc" + version: "13" - uses: ./.github/actions/setup with: python-version: ${{ matrix.python-version }} From 4b7856f7a26510b35b9141c9a38d06857595b2b5 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:13:10 +0200 Subject: [PATCH 37/46] Make install command verbose when running tests --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 568a95d..5262a5b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -118,7 +118,7 @@ jobs: # when people try to run without installing optional dependencies, # we should add a CI step that runs the tests without optional dependencies too. # We don't have that right now, because we're not sure this pain point exists. - uv-dependency-install-flags: "--all-extras --group tests" + uv-dependency-install-flags: "-v --reinstall-package example-fgen-basic -Ccompile-args='-v' --all-extras --group tests" - name: Run tests run: | From 4b209dd6a1ed62f592158d468d6b30ce0890f9e3 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:17:59 +0200 Subject: [PATCH 38/46] Clean up and comment --- .github/workflows/ci.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5262a5b..2ca0e2d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -118,10 +118,9 @@ jobs: # when people try to run without installing optional dependencies, # we should add a CI step that runs the tests without optional dependencies too. # We don't have that right now, because we're not sure this pain point exists. - uv-dependency-install-flags: "-v --reinstall-package example-fgen-basic -Ccompile-args='-v' --all-extras --group tests" + uv-dependency-install-flags: "-v --reinstall-package example-fgen-basic -Ccompile-args='-v' --all-extras --group tests " - name: Run tests run: | - COV_DIR=`uv run --no-sync python -c 'from pathlib import Path; import example_fgen_basic; print(Path(example_fgen_basic.__file__).parent)'` uv run --no-sync pytest -r a -v tests src --doctest-modules --doctest-report ndiff --cov=${COV_DIR} --cov-report=term-missing --cov-report=xml uv run --no-sync coverage report @@ -240,6 +239,11 @@ jobs: check-build: strategy: matrix: + # The tests are also effectively a test of the build (at least the Fortran compilation). + # This test is really just about checking what is packaged + # and that we have all the required pieces. + # Hence, for now, only test on ubuntu + # (little value testing on other OS's because this test is not testing compilation directly). os: [ "ubuntu-latest" ] python-version: [ "3.11" ] runs-on: "${{ matrix.os }}" @@ -266,7 +270,6 @@ jobs: cd dist ls python3 -m venv venv - # TODO: alter for windows source venv/bin/activate pip install example_fgen_basic* python -c 'from example_fgen_basic.get_wavelength import get_wavelength_plain; print(get_wavelength_plain(23.4))' From 3b7417f07baf5a7d0ba951ba261a1d747e27407f Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:27:38 +0200 Subject: [PATCH 39/46] Update release workflow --- .github/workflows/build-wheels.yaml | 2 +- .github/workflows/deploy.yaml | 22 +++--- .github/workflows/release.yaml | 111 ++++++++++++++++++++++++++-- 3 files changed, 114 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml index c65406d..1dc6f40 100644 --- a/.github/workflows/build-wheels.yaml +++ b/.github/workflows/build-wheels.yaml @@ -115,7 +115,7 @@ jobs: # id-token: write runs-on: ubuntu-latest steps: - - name: Download artefacts + - name: Download artifacts uses: actions/download-artifact@v5 with: pattern: cibw-* diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index ef24f4c..ee3ae75 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -24,19 +24,15 @@ jobs: # this permission is mandatory for trusted publishing with PyPI id-token: write steps: - - name: Check out repository - uses: actions/checkout@v4 + # TODO: figure out how to download from release step + - name: Download artifacts + uses: actions/download-artifact@v5 with: - fetch-depth: 0 - - uses: ./.github/actions/setup - with: - python-version: ${{ matrix.python-version }} - uv-dependency-install-flags: "--all-extras --group dev" + pattern: cibw-* + path: dist + merge-multiple: true - name: Publish to PyPI run: | - # TODO: move to using cibuildwheel so we have wheels for multiple platforms and python versions - # starting docs: https://cibuildwheel.pypa.io/en/stable/ - uv build --sdist - uv publish - # Just in case, undo the changes to `pyproject.toml` - git restore --staged . && git restore . + # uv publish + # # Just in case, undo the changes to `pyproject.toml` + # git restore --staged . && git restore . diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 17dbefe..0c23b61 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,15 +2,111 @@ name: Release on: push: - tags: ['v*'] + # tags: ['v*'] defaults: run: shell: bash jobs: + build-wheels: + name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} + runs-on: ${{ matrix.os }} + env: + # 3.9, 3.10 seem to not be happy on windows arm64 + # because you can't install numpy from a wheel for the build environment + # (and we're not going to try recompiling from source) + CIBW_SKIP: "cp39-win_arm64 cp310-win_arm64" + # TODO: consider turning this on + # CIBW_ENABLE: cpython-freethreading + CIBW_BEFORE_BUILD_WINDOWS: >- + pip install delvewheel + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- + delvewheel repair -w {dest_dir} {wheel} + CIBW_BEFORE_TEST: >- + pip install -r {project}/requirements-only-tests-min-locked.txt + CIBW_TEST_COMMAND: >- + pytest {project}/tests + MACOSX_DEPLOYMENT_TARGET: "13.0" + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + cibw_archs: "x86_64" + - os: ubuntu-24.04-arm + cibw_archs: "aarch64" + - os: windows-2025 + cibw_archs: "AMD64" + - os: windows-11-arm + cibw_archs: "ARM64" + - os: macos-13 + cibw_archs: "x86_64" + - os: macos-14 + cibw_archs: "arm64" + + steps: + - uses: actions/checkout@v5 + - name: Install Fortran compiler - MacOS + # When building on Mac, we need to have a Fortran compiler + if: ${{ startsWith(matrix.os, 'macos') }} + uses: fortran-lang/setup-fortran@v1 + id: setup-fortran-macos + with: + # TODO: figure out whether we need/want to use other compilers too + compiler: "gcc" + version: "13" + - name: Specify LLVM - windows-arm + if: ${{ matrix.os == 'windows-11-arm' }} + shell: pwsh + run: | + Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -OutFile LLVM-woa64.exe + Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait + + $env:PATH = "C:\Program Files\LLVM\bin;" + $env:PATH + echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "FC=flang-new" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "AR=llvm-lib.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + - name: Build wheels + uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 + with: + package-dir: . + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + env: + CIBW_ARCHS: ${{ matrix.cibw_archs }} + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} + path: ./wheelhouse/*.whl + if-no-files-found: error + + make-sdist: + name: Make source distribution + runs-on: "ubuntu-latest" + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: ./.github/actions/setup + with: + python-version: ${{ matrix.python-version }} + uv-dependency-install-flags: "--all-extras --group dev" + - name: Create source distribution + run: uv build --sdist + - name: Upload the source distribution artefact + uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + draft-release: name: Create draft release + needs: [ build-wheels, make-sdist ] strategy: matrix: os: [ "ubuntu-latest" ] @@ -29,11 +125,6 @@ jobs: run: | PROJECT_VERSION=`sed -ne 's/^version = "\([0-9\.]*\)"/\1/p' pyproject.toml` echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV - - name: Build package for PyPI - run: | - uv build - # Just in case, undo the changes to `pyproject.toml` - git restore --staged . && git restore . - name: Generate Release Notes run: | echo "" >> ".github/release_template.md" @@ -44,6 +135,12 @@ jobs: echo "## Changes" >> ".github/release_template.md" echo "" >> ".github/release_template.md" git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty='format:* %h %s' --no-merges >> ".github/release_template.md" + - name: Download artifacts + uses: actions/download-artifact@v5 + with: + pattern: cibw-* + path: dist + merge-multiple: true - name: Create Release Draft uses: softprops/action-gh-release@v2 with: @@ -51,5 +148,5 @@ jobs: token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" draft: true files: | - dist/example_fgen_basic-${{ env.PROJECT_VERSION }}-py3-none-any.whl + dist/example_fgen_basic-${{ env.PROJECT_VERSION }}-*.whl dist/example_fgen_basic-${{ env.PROJECT_VERSION }}.tar.gz From 6d2167ad9a53662b0421f56450d47de654a6655c Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:44:10 +0200 Subject: [PATCH 40/46] Fix error in release glob --- .github/workflows/deploy.yaml | 13 ++++--- .github/workflows/download-playground.yaml | 41 ++++++++++++++++++++++ .github/workflows/release.yaml | 9 ++--- 3 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/download-playground.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index ee3ae75..bb49b17 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -26,11 +26,14 @@ jobs: steps: # TODO: figure out how to download from release step - name: Download artifacts - uses: actions/download-artifact@v5 - with: - pattern: cibw-* - path: dist - merge-multiple: true + run: | + gh release download --pattern "*.whl" + gh release download --pattern "*.tar.gz" + - name: Move artifacts into dist + run: | + # TODO + gh release download --pattern "*.whl" + gh release download --pattern "*.tar.gz" - name: Publish to PyPI run: | # uv publish diff --git a/.github/workflows/download-playground.yaml b/.github/workflows/download-playground.yaml new file mode 100644 index 0000000..2032f18 --- /dev/null +++ b/.github/workflows/download-playground.yaml @@ -0,0 +1,41 @@ +name: Download playground + +on: + push: + +defaults: + run: + shell: bash + +jobs: + deploy-pypi: + name: Deploy to PyPI + # Having an environment for deployment is strongly recommend by PyPI + # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions + # You can comment this line out if you don't want it. + # environment: deploy + strategy: + matrix: + os: [ "ubuntu-latest" ] + python-version: [ "3.11" ] + runs-on: "${{ matrix.os }}" + # permissions: + # # this permission is mandatory for trusted publishing with PyPI + # id-token: write + steps: + - name: Download artifacts + run: | + # gh release download --pattern "*.whl" + gh release download --pattern "*.tar.gz" + - name: Move artifacts into dist + run: | + ls + tree + # TODO + # + ls dist + # - name: Publish to PyPI + # run: | + # # uv publish + # # # Just in case, undo the changes to `pyproject.toml` + # # git restore --staged . && git restore . diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0c23b61..756415e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,6 +2,7 @@ name: Release on: push: + # TODO: turn back on # tags: ['v*'] defaults: @@ -121,10 +122,6 @@ jobs: with: python-version: ${{ matrix.python-version }} uv-dependency-install-flags: "--all-extras --group dev" - - name: Add version to environment - run: | - PROJECT_VERSION=`sed -ne 's/^version = "\([0-9\.]*\)"/\1/p' pyproject.toml` - echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV - name: Generate Release Notes run: | echo "" >> ".github/release_template.md" @@ -148,5 +145,5 @@ jobs: token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" draft: true files: | - dist/example_fgen_basic-${{ env.PROJECT_VERSION }}-*.whl - dist/example_fgen_basic-${{ env.PROJECT_VERSION }}.tar.gz + dist/example_fgen_basic-*.whl + dist/example_fgen_basic-*.tar.gz From 2fc8249d31bdfa2f8087dd8f6db8cff2e863338e Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:47:09 +0200 Subject: [PATCH 41/46] Add token to download playground --- .github/workflows/download-playground.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/download-playground.yaml b/.github/workflows/download-playground.yaml index 2032f18..3d34071 100644 --- a/.github/workflows/download-playground.yaml +++ b/.github/workflows/download-playground.yaml @@ -24,6 +24,8 @@ jobs: # id-token: write steps: - name: Download artifacts + env: + GH_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" run: | # gh release download --pattern "*.whl" gh release download --pattern "*.tar.gz" From 1b3ed211eee59ad0b1361c79325b8e48885330a8 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:47:50 +0200 Subject: [PATCH 42/46] Add checkout repo step to download playground --- .github/workflows/download-playground.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/download-playground.yaml b/.github/workflows/download-playground.yaml index 3d34071..1b8739d 100644 --- a/.github/workflows/download-playground.yaml +++ b/.github/workflows/download-playground.yaml @@ -23,6 +23,10 @@ jobs: # # this permission is mandatory for trusted publishing with PyPI # id-token: write steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Download artifacts env: GH_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" From e3e41ed32c69835b84dc60bb6027625000099721 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 11:56:53 +0200 Subject: [PATCH 43/46] Fix up download steps and propagate to deploy --- .github/workflows/deploy.yaml | 29 +++++++++++++--------- .github/workflows/download-playground.yaml | 14 +++-------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index bb49b17..b99fa35 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -24,18 +24,23 @@ jobs: # this permission is mandatory for trusted publishing with PyPI id-token: write steps: - # TODO: figure out how to download from release step + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Download artifacts + env: + GH_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" run: | - gh release download --pattern "*.whl" - gh release download --pattern "*.tar.gz" - - name: Move artifacts into dist - run: | - # TODO - gh release download --pattern "*.whl" - gh release download --pattern "*.tar.gz" + gh release download --pattern "*.whl" --dir dist + gh release download --pattern "*.tar.gz" --dir dist + # Check what we have + tree + tree dist + - name: Setup uv + id: setup-uv + uses: astral-sh/setup-uv@v4 + with: + version: "0.8.8" - name: Publish to PyPI - run: | - # uv publish - # # Just in case, undo the changes to `pyproject.toml` - # git restore --staged . && git restore . + run: uv publish diff --git a/.github/workflows/download-playground.yaml b/.github/workflows/download-playground.yaml index 1b8739d..6c21f8b 100644 --- a/.github/workflows/download-playground.yaml +++ b/.github/workflows/download-playground.yaml @@ -31,17 +31,11 @@ jobs: env: GH_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" run: | - # gh release download --pattern "*.whl" - gh release download --pattern "*.tar.gz" - - name: Move artifacts into dist - run: | - ls + gh release download --pattern "*.whl" --dir dist + gh release download --pattern "*.tar.gz" --dir dist + # Check what we have tree - # TODO - # - ls dist + tree dist # - name: Publish to PyPI # run: | # # uv publish - # # # Just in case, undo the changes to `pyproject.toml` - # # git restore --staged . && git restore . From 7fc9c122d8db65bc0aa060343c51cb22caf66672 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 12:02:31 +0200 Subject: [PATCH 44/46] Clean up actions --- .github/workflows/build-wheels.yaml | 127 --------------------- .github/workflows/deploy.yaml | 1 - .github/workflows/download-playground.yaml | 41 ------- .github/workflows/release.yaml | 3 +- 4 files changed, 1 insertion(+), 171 deletions(-) delete mode 100644 .github/workflows/build-wheels.yaml delete mode 100644 .github/workflows/download-playground.yaml diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml deleted file mode 100644 index 1dc6f40..0000000 --- a/.github/workflows/build-wheels.yaml +++ /dev/null @@ -1,127 +0,0 @@ -name: Build wheels -# TODO: move into the release-deploy workflow and only run on published releases -# on: -# release: -# types: [published] -on: [push] - -jobs: - build-wheels: - name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} - runs-on: ${{ matrix.os }} - env: - # 3.9, 3.10 seem to not be happy on windows arm64 - # because you can't install numpy from a wheel for the build environment - # (and we're not going to try recompiling from source) - CIBW_SKIP: "cp39-win_arm64 cp310-win_arm64" - # TODO: consider turning this on - # CIBW_ENABLE: cpython-freethreading - CIBW_BEFORE_BUILD_WINDOWS: >- - pip install delvewheel - CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- - delvewheel repair -w {dest_dir} {wheel} - # TODO: switch to building based on locked src - # and use tests-min-locked here - CIBW_BEFORE_TEST: >- - pip install -r {project}/requirements-only-tests-min-locked.txt - CIBW_TEST_COMMAND: >- - pytest {project}/tests - MACOSX_DEPLOYMENT_TARGET: "13.0" - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-latest - cibw_archs: "x86_64" - - os: ubuntu-24.04-arm - cibw_archs: "aarch64" - - os: windows-2025 - cibw_archs: "AMD64" - - os: windows-11-arm - cibw_archs: "ARM64" - - os: macos-13 - cibw_archs: "x86_64" - - os: macos-14 - cibw_archs: "arm64" - - steps: - - uses: actions/checkout@v5 - - name: Install Fortran compiler - MacOS - # When building on Mac, we need to have a Fortran compiler - if: ${{ startsWith(matrix.os, 'macos') }} - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran-macos - with: - # TODO: figure out whether we need/want to use other compilers too - compiler: "gcc" - version: "13" - - name: Specify LLVM - windows-arm - if: ${{ matrix.os == 'windows-11-arm' }} - shell: pwsh - run: | - Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -OutFile LLVM-woa64.exe - Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait - - $env:PATH = "C:\Program Files\LLVM\bin;" + $env:PATH - echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - echo "FC=flang-new" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - echo "AR=llvm-lib.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Build wheels - uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3 - with: - package-dir: . - output-dir: wheelhouse - config-file: "{package}/pyproject.toml" - env: - CIBW_ARCHS: ${{ matrix.cibw_archs }} - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} - path: ./wheelhouse/*.whl - if-no-files-found: error - - make-sdist: - name: Make source distribution - runs-on: "ubuntu-latest" - steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: ./.github/actions/setup - with: - python-version: ${{ matrix.python-version }} - uv-dependency-install-flags: "--all-extras --group dev" - - name: Create source distribution - run: uv build --sdist - - name: Upload the source distribution artefact - uses: actions/upload-artifact@v4 - with: - name: cibw-sdist - path: dist/*.tar.gz - - deploy-pypi: - needs: [ build-wheels, make-sdist ] - # Having an environment for deployment is strongly recommend by PyPI - # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions - # You can comment this line out if you don't want it. - # # TODO: turn back on when we only run this on main - # environment: deploy - # permissions: - # # this permission is mandatory for trusted publishing with PyPI - # id-token: write - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v5 - with: - pattern: cibw-* - path: dist - merge-multiple: true - - name: Publish to PyPI - run: | - ls dist - # uv publish diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b99fa35..7e881b0 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -35,7 +35,6 @@ jobs: gh release download --pattern "*.whl" --dir dist gh release download --pattern "*.tar.gz" --dir dist # Check what we have - tree tree dist - name: Setup uv id: setup-uv diff --git a/.github/workflows/download-playground.yaml b/.github/workflows/download-playground.yaml deleted file mode 100644 index 6c21f8b..0000000 --- a/.github/workflows/download-playground.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Download playground - -on: - push: - -defaults: - run: - shell: bash - -jobs: - deploy-pypi: - name: Deploy to PyPI - # Having an environment for deployment is strongly recommend by PyPI - # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions - # You can comment this line out if you don't want it. - # environment: deploy - strategy: - matrix: - os: [ "ubuntu-latest" ] - python-version: [ "3.11" ] - runs-on: "${{ matrix.os }}" - # permissions: - # # this permission is mandatory for trusted publishing with PyPI - # id-token: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Download artifacts - env: - GH_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" - run: | - gh release download --pattern "*.whl" --dir dist - gh release download --pattern "*.tar.gz" --dir dist - # Check what we have - tree - tree dist - # - name: Publish to PyPI - # run: | - # # uv publish diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 756415e..bea4913 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,8 +2,7 @@ name: Release on: push: - # TODO: turn back on - # tags: ['v*'] + tags: ['v*'] defaults: run: From 014502e96f5b2413b1ab6ff2ff9fef871d35f4f5 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 12:04:21 +0200 Subject: [PATCH 45/46] CHANGELOG --- changelog/21.feature.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/21.feature.md diff --git a/changelog/21.feature.md b/changelog/21.feature.md new file mode 100644 index 0000000..2328eae --- /dev/null +++ b/changelog/21.feature.md @@ -0,0 +1 @@ +Added compilation and publication to PyPI of wheels for major OS's and supported Python versions From 112718125570476d774ba6230553e7958bbed867 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Wed, 27 Aug 2025 12:08:26 +0200 Subject: [PATCH 46/46] Update dev docs with key links --- docs/development.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index 832dfe1..1b02821 100644 --- a/docs/development.md +++ b/docs/development.md @@ -51,6 +51,12 @@ that will be performed to be manually specified. See the `uv version` docs (specifically the `--bump` flag) for the [list of available bump rules](https://docs.astral.sh/uv/reference/cli/#uv-version). +Releasing also includes building of wheels for major operating systems and supported Python versions. +This is done thanks to [cibuildwheel](https://cibuildwheel.pypa.io/), an incredible service. +The wheel building can be quite tricky and fiddly. +If there are issues, we recommend starting with the [cibuildwheel](https://cibuildwheel.pypa.io/) docs +or raising an issue to discuss with the other maintainers. + ### Standard process The steps required are the following: @@ -65,7 +71,8 @@ The steps required are the following: (see here: [project releases](https://github.com/openscm/example-fgen-basic/releases)). Once you are happy with the release - (removed placeholders, added key announcements etc.) + (removed placeholders, added key announcements, + checked that all the expected wheels and source distribution is there etc.) then hit 'Publish release'. This triggers a release to PyPI (which you can then add to the release if you want).