Skip to content

Commit

Permalink
Build wheels with numpy 2.0.
Browse files Browse the repository at this point in the history
Test wheels witht the oldest supported numpy.
  • Loading branch information
joaander committed May 23, 2024
1 parent 5cd0c84 commit dd0295e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 66 deletions.
66 changes: 50 additions & 16 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,66 @@ env:

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.21.6'
oldest_scipy: '1.5.4'
oldest_gsd: '2.5.0'
oldest_matplotlib: '3.3.3'
- version: 'cp310'
oldest_numpy: '1.21.6'
oldest_scipy: '1.7.2'
oldest_gsd: '2.5.0'
oldest_matplotlib: '3.5.0'
- version: 'cp311'
oldest_numpy: '1.23.2'
oldest_scipy: '1.9.2'
oldest_gsd: '2.7.0'
oldest_matplotlib: '3.6.0'
- version: 'cp312'
oldest_numpy: '1.26.2'
oldest_scipy: '1.11.2'
oldest_gsd: '3.2.0'
oldest_matplotlib: '3.7.3'

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,14 +93,12 @@ 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==8.2.1 sympy==1.10 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:
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.

13 changes: 0 additions & 13 deletions .github/workflows/oldest-test-reqs.txt

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython>=3.0.2", "scikit-build>=0.17.3", "cmake"]
requires = ["setuptools", "wheel", "numpy>=2.0.0rc1", "cython>=3.0.2", "scikit-build>=0.17.3", "cmake"]

[tool.black]
target-version = ['py36']
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"Source Code": "https://github.com/glotzerlab/freud",
"Issue Tracker": "https://github.com/glotzerlab/freud/issues",
},
python_requires=">=3.8",
python_requires=">=3.9",
install_requires=[
"numpy>=1.14",
"numpy>=1.19.0",
"rowan>=1.2.1",
"scipy>=1.1",
],
Expand Down

0 comments on commit dd0295e

Please sign in to comment.