Repository navigation
BLD: Add Android and iOS wheels #86
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,7 +91,7 @@ jobs: | |
|
|
||
| build_wheels: | ||
| if: github.repository == 'numpy/numpy-release' | ||
| name: BLD > ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }} | ||
| name: ${{ matrix.python }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} | ||
| runs-on: ${{ matrix.buildplat[0] }} | ||
| needs: [check_lock] | ||
| strategy: | ||
|
|
@@ -113,15 +113,32 @@ jobs: | |
| - [macos-15, macosx_arm64, accelerate] | ||
| - [windows-2022, win_amd64, ""] | ||
| - [windows-11-arm, win_arm64, ""] | ||
| - [ubuntu-24.04, android_arm64_v8a] | ||
| - [ubuntu-24.04, android_x86_64] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hold on, what's with the two entries for iOS and android? I can't remember that being discussed.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's discuss it in numpy/numpy#33334. |
||
| - [macos-26, ios_arm64_iphoneos] | ||
| - [macos-26, ios_arm64_iphonesimulator] | ||
| python: ["cp312", "cp313", "cp314", "cp314t", "cp315", "cp315t"] | ||
| exclude: | ||
| - buildplat: [ macos-15-intel, macosx_x86_64, openblas ] | ||
| python: "cp314t" | ||
| # Mobile platforms require Python 3.13 or later, and don't support free- | ||
| # threading yet. | ||
| - {buildplat: [ubuntu-24.04, android_arm64_v8a], python: cp312} | ||
| - {buildplat: [ubuntu-24.04, android_arm64_v8a], python: cp314t} | ||
| - {buildplat: [ubuntu-24.04, android_arm64_v8a], python: cp315t} | ||
| - {buildplat: [ubuntu-24.04, android_x86_64], python: cp312} | ||
| - {buildplat: [ubuntu-24.04, android_x86_64], python: cp314t} | ||
| - {buildplat: [ubuntu-24.04, android_x86_64], python: cp315t} | ||
| - {buildplat: [macos-26, ios_arm64_iphoneos], python: cp312} | ||
| - {buildplat: [macos-26, ios_arm64_iphoneos], python: cp314t} | ||
| - {buildplat: [macos-26, ios_arm64_iphoneos], python: cp315t} | ||
| - {buildplat: [macos-26, ios_arm64_iphonesimulator], python: cp312} | ||
| - {buildplat: [macos-26, ios_arm64_iphonesimulator], python: cp314t} | ||
| - {buildplat: [macos-26, ios_arm64_iphonesimulator], python: cp315t} | ||
| include: | ||
| - buildplat: [ ubuntu-22.04, pyodide_wasm32, "" ] | ||
| python: "cp314" | ||
|
|
||
|
|
||
| steps: | ||
| - name: Checkout numpy-release | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
@@ -195,15 +212,12 @@ jobs: | |
| - name: Pyodide setup | ||
| if: ${{ matrix.buildplat[1] == 'pyodide_wasm32' }} | ||
| run: | | ||
| echo "CIBW_PLATFORM=pyodide" >> "$GITHUB_ENV" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed this variable because it's unnecessary when using the |
||
| echo "CIBW_ENVIRONMENT_PYODIDE=INSTALL_OPENBLAS=false" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@f9b966cfadf4109556cadc5bb39ddb72d0ce664e # v4.3.5 | ||
| env: | ||
| CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | ||
| SRC: ${{ github.workspace }}/numpy-src | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| with: | ||
| only: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | ||
| package-dir: numpy-src | ||
| output-dir: dist | ||
| config-file: cibuildwheel.toml | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| .openblas | ||
| numpy-src | ||
| dist |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| set -xe | ||
|
|
||
| PROJECT_DIR="${1:-$PWD}" | ||
| NUMPY_SRC_DIR="${1:-$PWD}/numpy-src" | ||
|
|
||
| PROJECT_DIR="${1:?}" | ||
| NUMPY_SRC_DIR="${2:?}" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed |
||
|
|
||
| # Update license | ||
| echo "" >> $NUMPY_SRC_DIR/LICENSE.txt | ||
|
|
@@ -24,7 +23,6 @@ if [[ $(python -c"import sys; print(sys.maxsize)") < $(python -c"import sys; pri | |
| export INSTALL_OPENBLAS=false | ||
| fi | ||
|
|
||
| OPENBLAS_GRP="" | ||
| # Install OpenBLAS from scipy-openblas32|64 | ||
| if [[ "$INSTALL_OPENBLAS" = "true" ]] ; then | ||
| # By default, use scipy-openblas64 | ||
|
|
@@ -34,7 +32,6 @@ if [[ "$INSTALL_OPENBLAS" = "true" ]] ; then | |
| if [[ $RUNNER_ARCH == "ARM64" && $RUNNER_OS == "Windows" ]] ; then | ||
| OPENBLAS=openblas32 | ||
| fi | ||
| OPENBLAS_GRP="--group $OPENBLAS" | ||
| fi | ||
|
|
||
| # install build dependencies via uv | ||
|
|
@@ -43,8 +40,35 @@ uv --version | |
| # the lock file lives in this repo, not in the numpy checkout; the check_lock job in | ||
| # wheels.yml verifies it still matches numpy's dependency groups | ||
| PYTHON_EXE="$(python -c 'import sys; print(sys.executable)')" | ||
| uv export --project "$PROJECT_DIR" --no-default-groups --group build --no-emit-project $OPENBLAS_GRP --frozen | \ | ||
| uv pip install --python "$PYTHON_EXE" --no-deps --require-hashes -r - | ||
|
|
||
| function install_group { | ||
| uv export --project "$PROJECT_DIR" --no-default-groups --group ${1:?} --no-emit-project --frozen | \ | ||
| uv pip install --python "$PYTHON_EXE" --no-deps --require-hashes -r - | ||
| } | ||
|
|
||
| # When cross-compiling, we need to temporarily modify the virtual environment in order | ||
| # to install for the build platform, not the host platform. | ||
| site_packages=$(python3 -c ' | ||
| import sys | ||
| print(next(entry for entry in sys.path if entry.endswith("site-packages"))) | ||
| ') | ||
| cross_pth="$site_packages/_cross_venv.pth" | ||
| if [ -e "$cross_pth" ]; then | ||
| mv "$cross_pth" "$cross_pth.disabled" | ||
| fi | ||
|
|
||
| install_group build | ||
|
|
||
| if [ -e "$cross_pth.disabled" ]; then | ||
| mv "$cross_pth.disabled" "$cross_pth" | ||
| fi | ||
|
|
||
| # uv caches each virtual environment's platform, so we need to clear that before | ||
| # installing OpenBLAS for the host platform. | ||
| uv cache clear | ||
| if [ -n "$OPENBLAS" ]; then | ||
| install_group $OPENBLAS | ||
| fi | ||
|
|
||
| # Configure the pkg-config file for OpenBLAS | ||
| if [[ "$INSTALL_OPENBLAS" = "true" ]] ; then | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shortening the name makes the web UI much more readable, especially when expanding the matrix in the flowchart.