From 2bc8c99975b0d7eefb5f014a484b22c6cbf224a2 Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Wed, 29 Jul 2026 08:27:09 -0400 Subject: [PATCH 1/7] Set minimum supported python to 3.9 --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 952cfbbe..c07eaff8 100644 --- a/setup.py +++ b/setup.py @@ -115,6 +115,8 @@ ), long_description=long_description, long_description_content_type="text/markdown", + # Support Python versions where Raysect wheels are available. + requires_python=">=3.9", install_requires=[ "numpy>=2.0", "scipy", From 964c79e3c64f1fca0a69519d73d124a73b2e04f7 Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Thu, 27 Aug 2026 11:54:28 -0400 Subject: [PATCH 2/7] Add an action to build distributions on tagged releases Use the CIbuildwheel Github action to build wheels for all currently-supported Python versions. Manylinux wheels are produced, using the manylinux2014 image where possible (to support JET/UKAEA computers which still run SL7), with manylinux_2_28 for Python 3.14 as that isn't available in manylinux2014. Only Linux wheels are built for now: MacOS (and Windows should Raysect ever support it) are deferred. But the strategy matrix for the wheels is written in such a way as to easily add other OS's or architectures later as necessary. To avoid wasting compute cycles, the workflow is configured to only run on tagged pushes: we manually tag RC and stable releases so should only get distributions on these versions. If necessary, tagging a development version with an M.m.p.dev version can also trigger a build. Automatic uploading to PyPI is not implemented: the distribution files should be downloaded from the `gather_artifacts` job's artifacts and checked locally before uploading to PyPI. This is to reduce the risk of uploading broken distributions: if the process proves robust and reliable then automatic uploading to PyPI can be revisited. Addresses one of the items in #507 --- .github/workflows/build.yml | 78 +++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f2954daa --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,78 @@ +name: Build wheels + +# We don't want to spend CI compute cycles on every commit, so restrict building +# of wheels to releases and candidate releases. These are releases which will be +# tagged manually with a vM.m.p[.rcN] version. +# Builds can also be triggered by tagging with a .dev version. +on: + push: + tags: + - 'v*' + +jobs: + # Build a wheel for each Python version in a separate parallel job. + build_wheels: + name: Build wheels for ${{ matrix.py }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] # Only Linux for now, passive provision for other OS's. + python: [cp39, cp310, cp311, cp312, cp313, cp314] + + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@v4.2.0 + env: + CIBW_BUILD: ${{ matrix.python }}-manylinux_x86_64 + # Build on manylinux2014 where possible for greatest compatibility, + # but need newer manylinux_2_28 for Python 3.14 + CIBW_MANYLINUX_X86_64_IMAGE: >- + ${{ contains(matrix.python, 'cp314') && 'manylinux_2_28' || 'manylinux2014' }} + # Avoid trying to compile e.g. Pillow (raysect->matplotlib dependency) from + # source on older manylinux with newer Python. An old version is fine. + CIBW_ENVIRONMENT: 'PIP_PREFER_BINARY=1' + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ matrix.python }} + path: ./wheelhouse/*.whl + + make_sdist: + name: Make SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + # Wheels are built in parallel jobs: gather the outputs into a single artifact + # for more convenient retrieval. At some stage we may consider automatic + # upload to PyPI from this job (since its `needs` entry ensures the SDist and + # wheels all built successfully). + gather_artifacts: + name: Gather SDist and wheel outputs into a single artifact + runs-on: ubuntu-latest + needs: [build_wheels, make_sdist] + steps: + - uses: actions/download-artifact@v5 + with: + pattern: cibw* + path: dist + merge-multiple: true + + - uses: actions/upload-artifact@v4 + with: + name: artifacts + path: dist/* From bab59b6f3dd41fb5049b7e222bfe2a9c50afe427 Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Thu, 27 Aug 2026 12:05:28 -0400 Subject: [PATCH 3/7] Bump version to 1.6.0.dev3 Tag this commit to check the Cibuildwheel action. --- cherab/core/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cherab/core/VERSION b/cherab/core/VERSION index 8a3469e1..3c364a6a 100644 --- a/cherab/core/VERSION +++ b/cherab/core/VERSION @@ -1 +1 @@ -1.6.0.dev2 +1.6.0.dev3 From 91ac6b9d6b321f79db60eb5ec9d8af461db22b44 Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Mon, 7 Sep 2026 10:32:55 -0400 Subject: [PATCH 4/7] Address PR review comments --- .github/workflows/build.yml | 40 ++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2954daa..27e98cdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,12 +12,37 @@ on: jobs: # Build a wheel for each Python version in a separate parallel job. build_wheels: - name: Build wheels for ${{ matrix.py }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: Build wheels for ${{ matrix.python }} on ${{ matrix.target.name }} + runs-on: ${{ matrix.target.runner }} strategy: matrix: - os: [ubuntu-latest] # Only Linux for now, passive provision for other OS's. python: [cp39, cp310, cp311, cp312, cp313, cp314] + target: + - name: Linux (x86-64) + runner: ubuntu-latest + platform: manylinux_x86_64 + arch: x86_64 + + # TODO: add other platforms once Raysect provides wheels on them. + # - name: Linux (ARM) + # runner: ubuntu-24.04-arm + # platform: manylinux_aarch64 + # arch: aarch64 + + # - name: macOS (Apple Silicon) + # runner: macos-latest + # platform: macosx_arm64 + # arch: arm64 + + # - name: macOS (Intel) + # runner: macos-15-intel + # platform: macosx_x86_64 + # arch: x86_64 + + # - name: Windows + # runner: windows-2022 + # platform: win_amd64 + # arch: AMD64 steps: - uses: actions/checkout@v7 @@ -27,7 +52,8 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v4.2.0 env: - CIBW_BUILD: ${{ matrix.python }}-manylinux_x86_64 + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.target.platform }} + CIBW_ARCH: ${{ matrix.target.arch }} # Build on manylinux2014 where possible for greatest compatibility, # but need newer manylinux_2_28 for Python 3.14 CIBW_MANYLINUX_X86_64_IMAGE: >- @@ -38,7 +64,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-${{ matrix.python }} + name: dist-wheel-${{ matrix.target.platform }}-${{ matrix.python }} path: ./wheelhouse/*.whl make_sdist: @@ -54,7 +80,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: cibw-sdist + name: dist-sdist path: dist/*.tar.gz # Wheels are built in parallel jobs: gather the outputs into a single artifact @@ -68,7 +94,7 @@ jobs: steps: - uses: actions/download-artifact@v5 with: - pattern: cibw* + pattern: dist-* path: dist merge-multiple: true From a7964bf2289007602bc09f26d6f63cb17b786e1c Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Mon, 7 Sep 2026 10:33:43 -0400 Subject: [PATCH 5/7] Bump version to 1.6.0.dev4 for CIBW CI test --- cherab/core/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cherab/core/VERSION b/cherab/core/VERSION index 3c364a6a..18a4f925 100644 --- a/cherab/core/VERSION +++ b/cherab/core/VERSION @@ -1 +1 @@ -1.6.0.dev3 +1.6.0.dev4 From ab901ec107ff7d8491c8f33893b28ac1a3ade617 Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Mon, 7 Sep 2026 12:09:10 -0400 Subject: [PATCH 6/7] Change build workflow to only run on published releases --- .github/workflows/build.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27e98cdc..3fce0b19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,11 @@ name: Build wheels # We don't want to spend CI compute cycles on every commit, so restrict building -# of wheels to releases and candidate releases. These are releases which will be -# tagged manually with a vM.m.p[.rcN] version. -# Builds can also be triggered by tagging with a .dev version. +# of wheels to published releases. This includes stable and beta/RC releases. on: - push: - tags: - - 'v*' + release: + types: + - published jobs: # Build a wheel for each Python version in a separate parallel job. From 45439fd8d0149b1552718414bfbc29048f34a63f Mon Sep 17 00:00:00 2001 From: Jack Lovell Date: Tue, 8 Sep 2026 10:27:50 -0400 Subject: [PATCH 7/7] Move manylinux image determination to a separate step This provides greater flexibility than the sort-of-ternary experssion available in Github Actions YAML, so it'll be easier in fiture to modify if we decide to provide wheels for newer Python versions while maintaining manylinux2014 support. --- .github/workflows/build.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3fce0b19..271e3b04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,15 +47,28 @@ jobs: with: persist-credentials: false + - name: Determine manylinux image + if: ${{ contains(matrix.target.name, 'Linux') }} + # Build on manylinux2014 where possible for greatest compatibility, + # but need newer manylinux_2_28 for Python >=3.14. + # TODO: use cp314|cp315 if we provide Python 3.15 wheels before dropping + # manylinux2014 (RHEL7) support. + # TODO: remove this step entirely once we drop manylinux2014 support. + run: | + case ${{ matrix.python }} in + cp314) + echo "CIBW_MANYLINUX_X86_64_IMAGE=manylinux_2_28" >> "$GITHUB_ENV" + ;; + *) + echo "CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014" >> "$GITHUB_ENV" + ;; + esac + - name: Build wheels uses: pypa/cibuildwheel@v4.2.0 env: CIBW_BUILD: ${{ matrix.python }}-${{ matrix.target.platform }} CIBW_ARCH: ${{ matrix.target.arch }} - # Build on manylinux2014 where possible for greatest compatibility, - # but need newer manylinux_2_28 for Python 3.14 - CIBW_MANYLINUX_X86_64_IMAGE: >- - ${{ contains(matrix.python, 'cp314') && 'manylinux_2_28' || 'manylinux2014' }} # Avoid trying to compile e.g. Pillow (raysect->matplotlib dependency) from # source on older manylinux with newer Python. An old version is fine. CIBW_ENVIRONMENT: 'PIP_PREFER_BINARY=1'