Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maturin v0.15 #215

Merged
merged 4 commits into from
May 9, 2023
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
53 changes: 40 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@ name: Test
on: [push, pull_request]

jobs:
py_build_deps:
outputs:
output: ${{ steps.extract_from_toml.outputs.output }}

runs-on: ubuntu-latest

defaults:
run:
working-directory: light-curve

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Extract build deps from pyproject.toml
id: extract_from_toml
run: |
echo "output="$(python -c 'import tomllib; print(" ".join(tomllib.load(open("pyproject.toml", "rb"))["build-system"]["requires"]))') >> "$GITHUB_OUTPUT"


test:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -45,6 +69,8 @@ jobs:
build:
runs-on: ${{ matrix.os }}

needs: [py_build_deps]

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -89,10 +115,6 @@ jobs:
run:
working-directory: light-curve

env:
# maturin sets it to 10.7, which is too low for Ceres
MACOSX_DEPLOYMENT_TARGET: '10.9'

steps:
- uses: actions/checkout@v3
- name: Install ceres on macOS
Expand Down Expand Up @@ -147,8 +169,8 @@ jobs:
python-version: '3.11'
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install maturin
run: python3 -mpip install 'maturin>=0.14,<0.15'
- name: Install build deps
run: python3 -mpip install "${{ needs.py_build_deps.outputs.output }}"
- name: Build wheels for abi3=${{ matrix.abi3 }} fftw=${{ matrix.fftw }} ceres=${{ matrix.ceres }} gsl=${{ matrix.gsl }}
run: |
maturin build --find-interpreter --manylinux=off --locked --no-default-features --features=fftw-${{ matrix.fftw }}${{ matrix.ceres == 'source' && ',ceres-source' || '' }}${{ matrix.ceres == 'system' && ',ceres-system' || '' }}${{ matrix.gsl && ',gsl' || '' }}${{ matrix.abi3 && ',abi3' || '' }}
Expand All @@ -165,6 +187,8 @@ jobs:
coverage:
runs-on: ubuntu-latest

needs: [py_build_deps]

defaults:
run:
working-directory: light-curve
Expand All @@ -182,8 +206,8 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install maturin
run: pip install $(python -c 'import tomllib; print(" ".join(tomllib.load(open("pyproject.toml", "rb"))["build-system"]["requires"]))')
- name: Install build deps
run: pip install "${{ needs.py_build_deps.outputs.output }}"
- name: Generate code coverage
run: |
source <(cargo llvm-cov show-env --export-prefix)
Expand All @@ -201,6 +225,8 @@ jobs:
msrv-build:
runs-on: ubuntu-latest

needs: [py_build_deps]

defaults:
run:
working-directory: light-curve
Expand Down Expand Up @@ -233,24 +259,25 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_msrv.outputs.msrv }}
- name: Install maturin
run: pip install 'maturin>=0.14,<0.15'
- name: Install build_deps
run: pip install "${{ needs.py_build_deps.outputs.output }}"
- name: Build
run: |
rustup default ${{ steps.get_msrv.outputs.msrv }}
maturin build --find-interpreter

arm:

runs-on: [self-hosted, linux, ARM64]

needs: [py_build_deps]

defaults:
run:
working-directory: light-curve

steps:
- uses: actions/checkout@v3
- name: install maturin
run: pip install 'maturin[patchelf]>=0.14,<0.15'
- name: Install build_deps
run: pip install "${{ needs.py_build_deps.outputs.output }}"
- name: Build
run: maturin build
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

--
- **Build breaking**: the only Python build requirement `maturin` updated from v0.14.x to v0.15

### Deprecated

Expand All @@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

--
- Building from sdist on x86-64 macOS required manual setting of `$MACOSX_DEPLOYMENT_TARGET` to 10.9 or higher. Recent `maturin` update allowed us to specify it via `pyproject.toml`

### Security

Expand Down
4 changes: 2 additions & 2 deletions light-curve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ We build aarch64 macOS 12.0+ Python 3.8+ wheels locally and submit them running
rm -rf ./wheelhouse
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
brew install gsl
CIBW_BUILD='cp3*-macosx_arm64' CIBW_ENVIRONMENT="MACOSX_DEPLOYMENT_TARGET=12.0 MATURIN_PEP517_ARGS='--locked --no-default-features --features ceres-source,fftw-source,gsl'" CIBW_BEFORE_ALL='' python3 -mcibuildwheel --platform macos
CIBW_BUILD='cp310-macosx_arm64' CIBW_ENVIRONMENT="MACOSX_DEPLOYMENT_TARGET=12.0 MATURIN_PEP517_ARGS='--locked --no-default-features --features ceres-source,fftw-source,gsl,abi3'" CIBW_BEFORE_ALL='' python3 -mcibuildwheel --platform macos
CIBW_BUILD='cp3*-macosx_arm64' CIBW_ENVIRONMENT="MATURIN_PEP517_ARGS='--locked --no-default-features --features ceres-source,fftw-source,gsl'" CIBW_BEFORE_ALL='' python3 -mcibuildwheel --platform macos
CIBW_BUILD='cp310-macosx_arm64' CIBW_ENVIRONMENT="MATURIN_PEP517_ARGS='--locked --no-default-features --features ceres-source,fftw-source,gsl,abi3'" CIBW_BEFORE_ALL='' python3 -mcibuildwheel --platform macos
twine upload wheelhouse/*.whl
```

Expand Down
10 changes: 9 additions & 1 deletion light-curve/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.14.0,<0.15"]
requires = ["maturin>=0.15,<0.16"]
build-backend = "maturin"

[project]
Expand Down Expand Up @@ -55,6 +55,14 @@ dynamic = [
# It asks to use Cargo.lock to make the build reproducible
locked = true

[tool.maturin.target.aarch64-apple-darwin]
# I belive Rust requires it
macos-deployment-target = "11.0"

[tool.maturin.target.x86_64-apple-darwin]
# Default is 10.7, but we need 10.9 for Ceres
macos-deployment-target = "10.9"

[tool.black]
line-length = 120
target-version = ["py37"]
Expand Down