From 5b16b5645133efc87e5f479fecddc8be3e56ecbc Mon Sep 17 00:00:00 2001 From: Jake Faulkner Date: Mon, 16 Feb 2026 10:52:35 +1300 Subject: [PATCH 1/7] ci: build matrix for multiple python and os versions --- .github/workflows/publish-PyPI.yml | 76 +++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish-PyPI.yml b/.github/workflows/publish-PyPI.yml index 00981fa5..c5c4f1ff 100644 --- a/.github/workflows/publish-PyPI.yml +++ b/.github/workflows/publish-PyPI.yml @@ -12,10 +12,41 @@ on: type: string jobs: - build: - name: Build distribution 📦 - runs-on: ubuntu-latest + build-wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag_name || github.ref }} + fetch-depth: 0 + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + + - name: Build wheels + uses: pypa/cibuildwheel@v2.21.0 + env: + CIBW_BUILD: cp312-* cp313-* cp314-* + CIBW_SKIP: "*-musllinux_*" + CIBW_ARCHS_MACOS: "x86_64 arm64" + CIBW_ARCHS_LINUX: "x86_64" + CIBW_ARCHS_WINDOWS: "AMD64" + + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions-${{ matrix.os }} + path: ./wheelhouse/*.whl + + build-sdist: + name: Build source distribution + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 @@ -27,23 +58,24 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.12" - - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: python3 -m build + + - name: Install build + run: python -m pip install build + + - name: Build sdist + run: python -m build --sdist + - name: Store the distribution packages uses: actions/upload-artifact@v4 with: - name: python-package-distributions - path: dist/ + name: python-package-distributions-sdist + path: dist/*.tar.gz + publish-to-pypi: name: Publish to PyPI needs: - - build + - build-wheels + - build-sdist runs-on: ubuntu-latest environment: @@ -54,10 +86,12 @@ jobs: id-token: write steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + pattern: python-package-distributions-* + path: dist + merge-multiple: true + + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 12a8691c2196cb1fa2161c4e041d96e5a82bfedd Mon Sep 17 00:00:00 2001 From: Jake Faulkner Date: Mon, 16 Feb 2026 10:57:47 +1300 Subject: [PATCH 2/7] ci: fix macos builds --- .github/workflows/publish-PyPI.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-PyPI.yml b/.github/workflows/publish-PyPI.yml index c5c4f1ff..404a07df 100644 --- a/.github/workflows/publish-PyPI.yml +++ b/.github/workflows/publish-PyPI.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Checkout code @@ -28,11 +28,15 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@stable + with: + # Adds both Mac architectures and Windows/Linux defaults + targets: x86_64-apple-darwin, aarch64-apple-darwin - name: Build wheels - uses: pypa/cibuildwheel@v2.21.0 + uses: pypa/cibuildwheel@v2.22.0 env: CIBW_BUILD: cp312-* cp313-* cp314-* + CIBW_PRERELEASE_PYTHONS: True CIBW_SKIP: "*-musllinux_*" CIBW_ARCHS_MACOS: "x86_64 arm64" CIBW_ARCHS_LINUX: "x86_64" From 12f46b0d74720c83195234f3fc7bd4f9039f5e57 Mon Sep 17 00:00:00 2001 From: Jake Faulkner Date: Mon, 16 Feb 2026 11:04:46 +1300 Subject: [PATCH 3/7] ci: install rust in ubuntu pypi builds --- .github/workflows/publish-PyPI.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/publish-PyPI.yml b/.github/workflows/publish-PyPI.yml index 404a07df..c8a5e027 100644 --- a/.github/workflows/publish-PyPI.yml +++ b/.github/workflows/publish-PyPI.yml @@ -41,6 +41,12 @@ jobs: CIBW_ARCHS_MACOS: "x86_64 arm64" CIBW_ARCHS_LINUX: "x86_64" CIBW_ARCHS_WINDOWS: "AMD64" + # cibuildwheel runs the linux versions only inside a + # container. This means we need to install rust inside that + # container before we go ahead and build. + CIBW_BEFORE_ALL_LINUX: > + curl https://sh.rustup.rs -sSf | sh -s -- -y && + source "$HOME/.cargo/env" - name: Store the distribution packages uses: actions/upload-artifact@v4 From 3f8d48425ba6714dd88b1b780e9ee6389c052805 Mon Sep 17 00:00:00 2001 From: Jake Faulkner Date: Mon, 16 Feb 2026 11:08:27 +1300 Subject: [PATCH 4/7] ci: set environment path to ensure rust can be found --- .github/workflows/publish-PyPI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-PyPI.yml b/.github/workflows/publish-PyPI.yml index c8a5e027..1a3d746f 100644 --- a/.github/workflows/publish-PyPI.yml +++ b/.github/workflows/publish-PyPI.yml @@ -47,6 +47,7 @@ jobs: CIBW_BEFORE_ALL_LINUX: > curl https://sh.rustup.rs -sSf | sh -s -- -y && source "$HOME/.cargo/env" + CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" - name: Store the distribution packages uses: actions/upload-artifact@v4 From b1730aaba920e9b8f13ad4cd0b1494e1c2d3c652 Mon Sep 17 00:00:00 2001 From: Jake Faulkner Date: Mon, 16 Feb 2026 11:19:25 +1300 Subject: [PATCH 5/7] fix(ims): also remove psa rotd maximum memory allocation --- IM/ims.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/IM/ims.py b/IM/ims.py index 89b7a9e8..6fe72ff3 100644 --- a/IM/ims.py +++ b/IM/ims.py @@ -93,7 +93,6 @@ def pseudo_spectral_acceleration( waveforms: ChunkedWaveformArray, periods: Array1D, dt: np.float64, - psa_rotd_maximum_memory_allocation: Optional[float] = None, cores: int = multiprocessing.cpu_count(), step: int | None = None, use_tqdm: bool = False, @@ -111,8 +110,6 @@ def pseudo_spectral_acceleration( Natural periods of the oscillators (s). dt : np.float64 Timestep resolution of the waveforms (s). - psa_rotd_maximum_memory_allocation : float, optional - Target maximum memory limit for rotation calculations. cores : int, optional Number of CPU cores for parallel processing via Rayon. step : int, optional From 8c169b6396f881128ae46ec3f8596d990dee46fd Mon Sep 17 00:00:00 2001 From: Jake Faulkner Date: Mon, 16 Feb 2026 11:22:51 +1300 Subject: [PATCH 6/7] fix(ims): remove unused import --- IM/ims.py | 1 - 1 file changed, 1 deletion(-) diff --git a/IM/ims.py b/IM/ims.py index 6fe72ff3..7bd5314d 100644 --- a/IM/ims.py +++ b/IM/ims.py @@ -8,7 +8,6 @@ from contextlib import contextmanager from enum import IntEnum, StrEnum from pathlib import Path -from typing import Optional import numpy as np import numpy.typing as npt From 0866960688fc3fa1493e2510ccc506fbdc398da2 Mon Sep 17 00:00:00 2001 From: Jake Faulkner Date: Mon, 16 Feb 2026 14:55:51 +1300 Subject: [PATCH 7/7] ci: only install in macOS Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/publish-PyPI.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-PyPI.yml b/.github/workflows/publish-PyPI.yml index 1a3d746f..fcde8452 100644 --- a/.github/workflows/publish-PyPI.yml +++ b/.github/workflows/publish-PyPI.yml @@ -28,8 +28,11 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@stable + + - name: Add macOS Rust targets + if: runner.os == 'macOS' + uses: dtolnay/rust-toolchain@stable with: - # Adds both Mac architectures and Windows/Linux defaults targets: x86_64-apple-darwin, aarch64-apple-darwin - name: Build wheels