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

Build wheels with numpy 2.0. #1252

Merged
merged 14 commits into from
May 31, 2024
Merged
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
* @glotzerlab/freud-developers
# Request maintainers for changes to requirements or CI
requirements/* @glotzerlab/freud-maintainers
requirements.txt @glotzerlab/freud-maintainers
.github @glotzerlab/freud-maintainers
.pre-commit-config.yaml @glotzerlab/freud-maintainers
1 change: 1 addition & 0 deletions .github/requirements-build-sdist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build == 1.1.1
12 changes: 12 additions & 0 deletions .github/requirements-build-sdist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements-build-sdist.in
#
build==1.1.1
# via -r requirements-build-sdist.in
packaging==24.0
# via build
pyproject-hooks==1.1.0
# via build
102 changes: 79 additions & 23 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build wheels

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
# Trigger on pushes to the mainline branches and version tags. This prevents building commits
# twice when the pull request source branch is in the same repository.
Expand All @@ -17,34 +21,79 @@ on:
workflow_dispatch:

env:
UV_VERSION: 0.2.2
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

jobs:
build_wheels:
name: Build wheel for ${{ matrix.os }}, Python ${{ matrix.pyver }}
runs-on: ${{ matrix.os }}
name: Build wheels [${{ matrix.python.version }}, ${{ matrix.os.base }}-${{ matrix.os.arch }}]
runs-on: ${{ matrix.os.base }}-${{ matrix.os.version }}
if: ${{ contains(github.event.pull_request.labels.*.name, 'build_wheels') || github.event_name != 'pull_request' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-14] #, windows-2019]
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os:
- base: ubuntu
version: latest
arch: 'x86_64'
# - base: windows
# version: latest
# arch: 'amd64'
- base: macos
version: 14
arch: 'arm64'
- base: macos
version: 13
arch: 'x86_64'

python:
# Pinned versions installed in CIBW_TEST_REQIURES are kept. Those defined installed in
# CIBW_BEFORE_TEST are often upgraded when the wheel is installed. This means we can't
# store the pinned requirements in a requirements file.
# Generate these version sets with commands like this:
# echo -e "numpy==1.21.6\nscipy\ngsd\nmatplotlib\nsympy" | uv pip compile --python-platform linux --python-version 3.9 --only-binary :all: - --resolution=lowest --no-deps
- version: 'cp39'
oldest_numpy: '1.22.4'
oldest_scipy: '1.7.3'
oldest_gsd: '2.5.0'
oldest_matplotlib: '3.5.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp310'
oldest_numpy: '1.22.4'
oldest_scipy: '1.7.3'
oldest_gsd: '2.7.0'
oldest_matplotlib: '3.5.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp311'
oldest_numpy: '1.23.2'
oldest_scipy: '1.9.2'
oldest_gsd: '2.7.0'
oldest_matplotlib: '3.6.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp312'
oldest_numpy: '1.26.2'
oldest_scipy: '1.11.2'
oldest_gsd: '3.2.0'
oldest_matplotlib: '3.7.3'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'

steps:
- uses: actions/checkout@v4.1.4
- uses: actions/checkout@v4.1.6
with:
submodules: "recursive"

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.18.1
env:
# Build for cpython >= 3.6.
CIBW_PROJECT_REQUIRES_PYTHON: "==${{ matrix.pyver }}.*"
CIBW_BUILD: "${{ matrix.python.version }}-*"
CIBW_SKIP: "{pp*,*-musllinux_*}"

# Build only on 64-bit architectures.
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_LINUX: auto64
CIBW_ARCHS_WINDOWS: auto64
CIBW_ARCHS: auto64

# Configure environment variables.
CIBW_ENVIRONMENT_LINUX: "CMAKE_PREFIX_PATH=/project/tbb LD_LIBRARY_PATH=/project/tbb/lib/intel64/gcc4.8:$LD_LIBRARY_PATH"
Expand All @@ -57,35 +106,42 @@ jobs:
CIBW_BEFORE_BUILD_WINDOWS: "powershell .github/workflows/cibuildwheel-before-build.ps1 {package}"

# Test the wheels.
CIBW_BEFORE_TEST_LINUX: "source .github/workflows/cibuildwheel-before-test.sh {package}"
CIBW_BEFORE_TEST_MACOS: "source .github/workflows/cibuildwheel-before-test.sh {package}"
CIBW_BEFORE_TEST_WINDOWS: "powershell .github/workflows/cibuildwheel-before-test.ps1 {package}"
CIBW_TEST_COMMAND: "cd {package}/tests && pytest . -v --log-level=DEBUG -n auto"
CIBW_TEST_REQUIRES: >
pytest==${{ matrix.python.oldest_pytest }}
sympy==${{ matrix.python.oldest_sympy }}
numpy==${{ matrix.python.oldest_numpy }}
scipy==${{ matrix.python.oldest_scipy }}
gsd==${{ matrix.python.oldest_gsd }}
matplotlib==${{ matrix.python.oldest_matplotlib }}
CIBW_TEST_COMMAND: "cd {package}/tests && pytest . -v --log-level=DEBUG"

- uses: actions/upload-artifact@v4.3.3
with:
name: dist-${{ matrix.os }}-${{ matrix.pyver }}
name: dist-${{ matrix.os.base }}-${{ matrix.os.version }}-${{ matrix.python.version }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'build_wheels') || github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v4.1.4
- uses: actions/checkout@v4.1.6
with:
submodules: "recursive"

- uses: actions/setup-python@v5.1.0
name: Install Python
with:
python-version: '3.9'
python-version: '3.12'

- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash

- name: Install build requirements
run: python3 -m pip --disable-pip-version-check install scikit-build cmake -r requirements.txt --upgrade --progress-bar=off
- name: Install build
run: 'uv pip install -r .github/requirements-build-sdist.txt --only-binary :all: --system --reinstall'

- name: Build sdist
run: python setup.py sdist
run: python -m build --sdist --outdir dist/ .

- uses: actions/upload-artifact@v4.3.3
with:
Expand Down Expand Up @@ -124,8 +180,8 @@ jobs:
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
repository-url: https://test.pypi.org/legacy/
skip-existing: true

- name: Slack notification
if: startsWith(github.ref, 'refs/tags/v') || failure()
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/cibuildwheel-before-test.ps1

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/cibuildwheel-before-test.sh

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/env-files/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: test
channels:
- conda-forge

dependencies:
- python==3.12
- tbb
- tbb-devel
- ninja
- cmake
- cython
- dynasor
- gsd
- matplotlib
- numpy
- pillow
- pytest
- rowan
- scikit-build
- scipy
- sympy
- uv
Loading
Loading