Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 69 additions & 21 deletions .github/workflows/publish-PyPI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,55 @@ 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-latest]

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: Add macOS Rust targets
if: runner.os == 'macOS'
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin, aarch64-apple-darwin

- name: Build wheels
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"
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"
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin"

- 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
Expand All @@ -27,23 +72,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:
Expand All @@ -54,10 +100,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
- 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
4 changes: 0 additions & 4 deletions IM/ims.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -93,7 +92,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,
Expand All @@ -111,8 +109,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
Expand Down
Loading