Skip to content

[CD] Refactor macOS wheel build scripts as a Python pipeline - #187944

Closed
zklaus wants to merge 4 commits into
pytorch:mainfrom
zklaus:cd-macos-python-scripts
Closed

zklaus wants to merge 4 commits into
pytorch:mainfrom
zklaus:cd-macos-python-scripts

Conversation

@zklaus

@zklaus zklaus commented Jun 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Refactors the macOS arm64 CD wheel build from the monolithic build_wheel.sh into the same staged Python pipeline already adopted for Linux (#182409) and Windows (#184407). This is the third and final platform, bringing macOS in line with the cross-platform structure.

Following the Linux template, the build is split into four single-responsibility modules under .ci/macwheel/, driven by a per-Python build.sh orchestrator that owns the stage contract:

  • build_env_setup.py — emits the macOS build flags (USE_DISTRIBUTED, deployment target, Metal/CoreML, libomp prefix) to an --env-out file the orchestrator sources
  • build_install_deps.py — pinned build/runtime deps + numpy pin; libomp via Homebrew when not staged
  • build_wheel.py — sets the arm64 host platform / ARCHFLAGS and runs python -m build --wheel --no-isolation
  • repair_wheel.py — delocates the wheel in place (the macOS analog of Linux's auditwheel/patchelf; Windows needs no repair)

build_all_macos_wheels.sh selects each interpreter and loops, reusing the ABI-free libtorch_cpu across Python versions via SKIP_SETUP_CLEAN (same incremental-build trick as Linux).

Notable points

  • macOS is arm64-only. Main builds no Intel-Mac wheels (the matrix emits only macos-arm64), so the pipeline is arm64-only by design — and the dead x86_64/BUILD_PYTHONLESS libtorch branches in the old build_wheel.sh are removed. macOS still ships a libtorch artifact, but it is extracted from the finished wheel by a later workflow job (.ci/libtorch/extract_libtorch_from_wheel.py), not produced by a separate BUILD_PYTHONLESS build.
  • Delocation moves inline into the per-Python build (repair_wheel.py), so the workflow drops its separate "Delocate all wheels" step.
  • Directory renamed .ci/wheel/ → .ci/macwheel/, parallel to Linux's .ci/manywheel/ (the old name was too generic for a macOS-only build).
  • build_install_deps.py uses spin clean rather than setup.py clean, matching Windows and surviving the eventual setup.py removal.

Review order

  1. build.sh (the stage contract), then the four stage modules
  2. build_all_macos_wheels.sh and the workflow template
  3. The second commit is a pure rename + spin clean switch

Test Plan

Static + structural checks locally:

python3 -m py_compile .ci/macwheel/*.py
bash -n .ci/macwheel/build.sh .ci/macwheel/build_all_macos_wheels.sh
python3 .github/scripts/generate_ci_workflows.py   # only the macOS workflow changes
lintrunner .ci/macwheel/* .github/templates/macos_binary_build_workflow.yml.j2

A from-source build on a dev Mac exercised the pipeline through environment setup, dependency install, CMake configure, and compilation, confirming the orchestration contract (venv handoff, --env-out sourcing, python -m build invocation). End-to-end wheel production + delocation is validated by this PR's ciflow/binaries run on the macos-arm64 runner.

Opening as a draft for a first round of CI.

🤖 Generated with Claude Code

@pytorch-bot

pytorch-bot Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/187944

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 17 Unclassified Failures

As of commit a350c45 with merge base 47edb83 (image):

NEW FAILURE - The following job has failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the release notes: releng release notes category label Jun 23, 2026
@zklaus zklaus added the ciflow/binaries Trigger all binary build and upload jobs on the PR label Jun 23, 2026
Comment thread .ci/macwheel/build.sh Resolved
@@ -0,0 +1,86 @@
#!/usr/bin/env python3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script should be shared across linux/windows and Mac, shouldn't it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree the duplication is real -- retry, pip_install, and numpy_pin are copy-pasted across all three (manywheel, windows, and this new macwheel). I would like to do the dedup as a focused follow-up rather than fold it in here: sharing them means editing all three directories plus establishing a stable import path (the three pipelines run from different CWDs/interpreters), and re-validating the Linux and Windows binary builds -- more scope than this macOS port should carry, and easy to get wrong silently.

Worth noting only the boilerplate unifies cleanly: the numpy pin tables genuinely differ per platform (mac cp313->2.1.0, win cp313->2.1.2, linux cp31->2.1.0 + --pre), so that data stays per-platform regardless.

Planned end-state is consolidating to .ci/wheel/{mac,linux,windows}/ with a shared _common.py (which Windows already partially has). Tracked as a follow-up; will pick it up right after this lands.

@malfet

malfet commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

@claude review this

@claude

claude Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

Claude finished @malfet's task in 4m 36s —— View job


PR Review

Nice work — the macOS pipeline reads cleanly and the parallel to .ci/manywheel/ is easy to follow. Below are my findings, leading with @malfet's two comments since both are on point.


1. build.sh:7-8 — the libtorch comment is stale (confirmed)

# Scope: wheels only. macOS ships no libtorch package (libtorch is built on
# Linux via .ci/libtorch/), so there is no BUILD_PYTHONLESS path here.

This is inaccurate on both clauses:

  • macOS does ship libtorch. The generated workflow has a libtorch-cpu-shared-with-deps-release-extract job (generated-macos-arm64-binary-wheel-nightly.yml:200) that runs .ci/libtorch/extract_libtorch_from_wheel.py --platform macos and uploads a libtorch-macos-arm64 artifact. extract_libtorch_from_wheel.py has explicit macOS handling (.dylib/.a libs, plus torch/.dylibs/). So macOS libtorch is real — it's just derived from the wheel this script builds, not a separate build.
  • .ci/libtorch/ is not "where libtorch is built on Linux." It's the cross-platform wheel-extraction tool, and macOS uses it too.

The point you actually want to make is: there's no separate BUILD_PYTHONLESS libtorch build on macOS — the libtorch artifact is extracted from the wheel post-build. Suggested rewrite:

# Scope: wheels only. There is no separate BUILD_PYTHONLESS libtorch build on
# macOS; the libtorch artifact is extracted from the finished wheel by a later
# workflow job (.ci/libtorch/extract_libtorch_from_wheel.py).

The same framing leaks into the PR description ("macOS ships no libtorch") — worth correcting there too so reviewers aren't misled.

Fix this →


2. build_install_deps.py — yes, this should largely be shared

@malfet is right. There are now three near-identical copies:

numpy retry pip_install numpy_pin clean step platform tail
.ci/manywheel/build_install_deps.py ✓ ✓ ✓ setup.py clean rocm build_amd.py
.ci/pytorch/windows/build_install_deps.py ✓ ✓ ✓ spin clean libuv extract
.ci/macwheel/build_install_deps.py (new) ✓ ✓ ✓ spin clean libomp via brew

retry, pip_install, and numpy_pin are copy-pasted verbatim across all three. The natural move is a shared helper module (e.g. .ci/ci_commons.py or similar) exposing those three, with each platform script keeping only its main() + platform tail. Windows already imports a _common for download/write_env_exports, so there's precedent.

Two things that argue against fully unifying main() (worth being explicit about in the PR so the scope is clear):

  • The numpy pin tables genuinely differ — mac cp313→2.1.0, win cp313→2.1.2, linux cp31→2.1.0 (note linux's cp31 prefix matches 3.10–3.13, the others pin 3.13 specifically). So the table data stays per-platform even if the lookup function is shared.
  • linux installs numpy with --pre; mac/win don't.

My suggestion: share retry/pip_install/numpy_pin (pure boilerplate) now, leave the per-platform main() and pin tables in place. That captures the bulk of the duplication without forcing a leaky abstraction. If you'd rather keep this PR focused on the macOS port, a tracking issue for the three-way dedup is a reasonable alternative — but the duplication is real and worth not growing silently.


Additional observations

build_env_setup.py:11-15 docstring mismatch. The Environment variables read: section lists OMP_PREFIX, but the code never reads OMP_PREFIX — it probes the path /opt/llvm-openmp and writes OMP_PREFIX to the env file. The docstring describes the behavior correctly in prose but files it under the wrong heading. Minor, but it'll confuse the next reader. Consider "Outputs:" or just dropping the heading.

build_install_deps.py:73 vs manywheel ordering. Here spin clean runs after the numpy/requirements installs; in manywheel setup.py clean runs between requirements-build.txt and requirements.txt. Almost certainly harmless (clean just wipes build/ artifacts), but since you're explicitly mirroring manywheel, a one-line note on why the order differs would save a future reader the diff.

build_wheel.py:32 does pip install build even though build_install_deps.py already installs requirements-build.txt. This matches the manywheel script verbatim, so I'd leave it — just flagging it's a (harmless) redundant install, consistent across both platforms.

Nit — repair_wheel.py:40 / build_wheel.py: the raw wheel dir is a mktemp -d that's never cleaned up (unlike ENV_FILE, which has a trap). On the CI runner it's ephemeral so it doesn't matter; not worth changing.

None of these are blocking. The two comments from @malfet are the substantive ones — #1 is a quick comment fix, #2 is a judgment call on scope (dedup now vs. follow-up issue).


  • Read the four stage modules + build.sh
  • Read build_all_macos_wheels.sh and workflow template
  • Address malfet's two review comments
  • Compare with Linux/Windows pipelines for the shared-script question
  • Post review
    · branch cd-macos-python-scripts

zklaus added 3 commits June 30, 2026 12:04
Port the macOS arm64 CD wheel build from the monolithic build_wheel.sh to
the same staged Python pipeline used for Linux (pytorch#182409) and Windows
(pytorch#184407): build_env_setup.py emits the macOS build flags to an env file,
build_install_deps.py installs the pinned build/runtime deps (and libomp
when not staged), build_wheel.py runs `python -m build`, and repair_wheel.py
delocates the wheel in place. A per-Python build.sh owns the stage contract;
build_all_macos_wheels.sh selects the interpreter and loops.

Delocation moves into the per-Python build (repair_wheel.py) instead of a
separate workflow step, so the template drops the "Delocate all wheels" step
and the generated workflow is regenerated to match.

build_wheel.sh and delocate_wheels.sh are removed: the former's wheel path is
superseded by the Python modules and its BUILD_PYTHONLESS/libtorch branch was
dead code (macOS ships no libtorch package; libtorch is built on Linux via
.ci/libtorch/), and the latter's logic now lives in repair_wheel.py.

Review in pipeline order: build.sh (the contract) first, then the four stage
modules, then build_all_macos_wheels.sh and the workflow template.

Test Plan:
Static checks only so far (no macOS runner in this environment):

```
python3 -m py_compile .ci/wheel/*.py
bash -n .ci/wheel/build.sh .ci/wheel/build_all_macos_wheels.sh
python3 .github/scripts/generate_ci_workflows.py   # regen, clean diff
lintrunner .ci/wheel/*.py .ci/wheel/*.sh \
    .github/templates/macos_binary_build_workflow.yml.j2 \
    .github/workflows/generated-macos-arm64-binary-wheel-nightly.yml
```

End-to-end validation on a macOS arm64 runner (the nightly wheel matrix) is
pending and will be exercised via ciflow/binaries.

Authored with assistance from Claude Code.
Rename the macOS-only wheel-build directory from the over-generic .ci/wheel
to .ci/macwheel, parallel to the Linux .ci/manywheel. Update the workflow
template and regenerate the generated workflow to match.

Also switch build_install_deps.py from `setup.py clean` to `spin clean`
(matching the Windows pipeline). Both call the same tools/clean.py today, but
`setup.py clean` stops working once the scikit-build-core migration removes
setup.py, whereas `spin clean` does not. The dependency install is reordered
so spin (from requirements.txt) is present before the clean runs.

Test Plan:

```
python3 -m py_compile .ci/macwheel/*.py
bash -n .ci/macwheel/build.sh .ci/macwheel/build_all_macos_wheels.sh
python3 .github/scripts/generate_ci_workflows.py   # only the macOS workflow changes
lintrunner .ci/macwheel/* \
    .github/templates/macos_binary_build_workflow.yml.j2 \
    .github/workflows/generated-macos-arm64-binary-wheel-nightly.yml
```

Authored with assistance from Claude Code.
Address review feedback on the macOS CD pipeline:

- build.sh: the scope comment claimed macOS ships no libtorch. It does -- the
  libtorch artifact is extracted from the finished wheel by a later workflow
  job (.ci/libtorch/extract_libtorch_from_wheel.py, which has macOS handling).
  What is true is that there is no separate BUILD_PYTHONLESS libtorch build on
  macOS; reword to say that.
- build_env_setup.py: OMP_PREFIX was listed under "Environment variables read"
  but the script writes it (to --env-out), not reads it. Move it under a
  "written" heading.

Authored with assistance from Claude Code.
@zklaus
zklaus force-pushed the cd-macos-python-scripts branch from 367a84a to a6dd57b Compare June 30, 2026 10:05
The macOS wheel build's numpy_pin() used a prefix table with a 2.0.2 default,
so an unsupported interpreter (e.g. a future 3.15, which the binary matrix does
not yet build on non-Linux OSes) would silently build against numpy 2.0.2
instead of erroring. The legacy .ci/wheel/build_wheel.sh used an explicit
per-version case with `exit 1` on the default arm; restore that fail-closed
behavior.

Replace the prefix table + default with an explicit per-version map covering the
versions actually built (3.10-3.14; freethreaded 3.14t shares 3.14's pin since
sys.version_info does not carry the `t`), and sys.exit with an actionable
message for anything unlisted -- so enabling a new Python forces a deliberate
pin choice here.

Test Plan:
- Exercised numpy_pin() with simulated sys.version_info for 3.10-3.14 (returns
  2.0.2 / 2.1.0 / 2.3.4 matching the legacy table) and 3.15 (exits with
  "Unsupported Python version 3.15: add a numpy pin ...").
- `lintrunner .ci/macwheel/build_install_deps.py` clean.

Authored with assistance from Claude Code.
@zklaus
zklaus marked this pull request as ready for review June 30, 2026 14:37
@zklaus
zklaus requested a review from a team as a code owner June 30, 2026 14:37
@zklaus
zklaus requested a review from atalman June 30, 2026 14:39

@atalman atalman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Thank you. cc @malfet if there are additional followups required, let us know we can provide a followup PR

@zklaus

zklaus commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -i

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 1, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

vishalgoyal316 pushed a commit to vishalgoyal316/pytorch that referenced this pull request Jul 16, 2026
…#187944)

## Summary

Refactors the macOS arm64 CD wheel build from the monolithic `build_wheel.sh` into the same staged Python pipeline already adopted for Linux (pytorch#182409) and Windows (pytorch#184407). This is the third and final platform, bringing macOS in line with the cross-platform structure.

Following the Linux template, the build is split into four single-responsibility modules under `.ci/macwheel/`, driven by a per-Python `build.sh` orchestrator that owns the stage contract:

- `build_env_setup.py` — emits the macOS build flags (`USE_DISTRIBUTED`, deployment target, Metal/CoreML, libomp prefix) to an `--env-out` file the orchestrator sources
- `build_install_deps.py` — pinned build/runtime deps + numpy pin; libomp via Homebrew when not staged
- `build_wheel.py` — sets the arm64 host platform / `ARCHFLAGS` and runs `python -m build --wheel --no-isolation`
- `repair_wheel.py` — delocates the wheel in place (the macOS analog of Linux's `auditwheel`/patchelf; Windows needs no repair)

`build_all_macos_wheels.sh` selects each interpreter and loops, reusing the ABI-free `libtorch_cpu` across Python versions via `SKIP_SETUP_CLEAN` (same incremental-build trick as Linux).

### Notable points

- **macOS is arm64-only.** Main builds no Intel-Mac wheels (the matrix emits only `macos-arm64`), so the pipeline is arm64-only by design — and the dead `x86_64`/`BUILD_PYTHONLESS` libtorch branches in the old `build_wheel.sh` are removed. macOS still ships a libtorch artifact, but it is *extracted from the finished wheel* by a later workflow job (`.ci/libtorch/extract_libtorch_from_wheel.py`), not produced by a separate `BUILD_PYTHONLESS` build.
- **Delocation moves inline** into the per-Python build (`repair_wheel.py`), so the workflow drops its separate "Delocate all wheels" step.
- **Directory renamed** `.ci/wheel/` → `.ci/macwheel/`, parallel to Linux's `.ci/manywheel/` (the old name was too generic for a macOS-only build).
- `build_install_deps.py` uses **`spin clean`** rather than `setup.py clean`, matching Windows and surviving the eventual `setup.py` removal.

### Review order

1. `build.sh` (the stage contract), then the four stage modules
2. `build_all_macos_wheels.sh` and the workflow template
3. The second commit is a pure rename + `spin clean` switch

## Test Plan

Static + structural checks locally:

```
python3 -m py_compile .ci/macwheel/*.py
bash -n .ci/macwheel/build.sh .ci/macwheel/build_all_macos_wheels.sh
python3 .github/scripts/generate_ci_workflows.py   # only the macOS workflow changes
lintrunner .ci/macwheel/* .github/templates/macos_binary_build_workflow.yml.j2
```

A from-source build on a dev Mac exercised the pipeline through environment setup, dependency install, CMake configure, and compilation, confirming the orchestration contract (venv handoff, `--env-out` sourcing, `python -m build` invocation). End-to-end wheel production + delocation is validated by this PR's `ciflow/binaries` run on the `macos-arm64` runner.

Opening as a draft for a first round of CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: pytorch#187944
Approved by: https://github.com/atalman
DamJanusz pushed a commit to DamJanusz/pytorch that referenced this pull request Jul 21, 2026
…#187944)

## Summary

Refactors the macOS arm64 CD wheel build from the monolithic `build_wheel.sh` into the same staged Python pipeline already adopted for Linux (pytorch#182409) and Windows (pytorch#184407). This is the third and final platform, bringing macOS in line with the cross-platform structure.

Following the Linux template, the build is split into four single-responsibility modules under `.ci/macwheel/`, driven by a per-Python `build.sh` orchestrator that owns the stage contract:

- `build_env_setup.py` — emits the macOS build flags (`USE_DISTRIBUTED`, deployment target, Metal/CoreML, libomp prefix) to an `--env-out` file the orchestrator sources
- `build_install_deps.py` — pinned build/runtime deps + numpy pin; libomp via Homebrew when not staged
- `build_wheel.py` — sets the arm64 host platform / `ARCHFLAGS` and runs `python -m build --wheel --no-isolation`
- `repair_wheel.py` — delocates the wheel in place (the macOS analog of Linux's `auditwheel`/patchelf; Windows needs no repair)

`build_all_macos_wheels.sh` selects each interpreter and loops, reusing the ABI-free `libtorch_cpu` across Python versions via `SKIP_SETUP_CLEAN` (same incremental-build trick as Linux).

### Notable points

- **macOS is arm64-only.** Main builds no Intel-Mac wheels (the matrix emits only `macos-arm64`), so the pipeline is arm64-only by design — and the dead `x86_64`/`BUILD_PYTHONLESS` libtorch branches in the old `build_wheel.sh` are removed. macOS still ships a libtorch artifact, but it is *extracted from the finished wheel* by a later workflow job (`.ci/libtorch/extract_libtorch_from_wheel.py`), not produced by a separate `BUILD_PYTHONLESS` build.
- **Delocation moves inline** into the per-Python build (`repair_wheel.py`), so the workflow drops its separate "Delocate all wheels" step.
- **Directory renamed** `.ci/wheel/` → `.ci/macwheel/`, parallel to Linux's `.ci/manywheel/` (the old name was too generic for a macOS-only build).
- `build_install_deps.py` uses **`spin clean`** rather than `setup.py clean`, matching Windows and surviving the eventual `setup.py` removal.

### Review order

1. `build.sh` (the stage contract), then the four stage modules
2. `build_all_macos_wheels.sh` and the workflow template
3. The second commit is a pure rename + `spin clean` switch

## Test Plan

Static + structural checks locally:

```
python3 -m py_compile .ci/macwheel/*.py
bash -n .ci/macwheel/build.sh .ci/macwheel/build_all_macos_wheels.sh
python3 .github/scripts/generate_ci_workflows.py   # only the macOS workflow changes
lintrunner .ci/macwheel/* .github/templates/macos_binary_build_workflow.yml.j2
```

A from-source build on a dev Mac exercised the pipeline through environment setup, dependency install, CMake configure, and compilation, confirming the orchestration contract (venv handoff, `--env-out` sourcing, `python -m build` invocation). End-to-end wheel production + delocation is validated by this PR's `ciflow/binaries` run on the `macos-arm64` runner.

Opening as a draft for a first round of CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: pytorch#187944
Approved by: https://github.com/atalman
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…#187944)

## Summary

Refactors the macOS arm64 CD wheel build from the monolithic `build_wheel.sh` into the same staged Python pipeline already adopted for Linux (pytorch#182409) and Windows (pytorch#184407). This is the third and final platform, bringing macOS in line with the cross-platform structure.

Following the Linux template, the build is split into four single-responsibility modules under `.ci/macwheel/`, driven by a per-Python `build.sh` orchestrator that owns the stage contract:

- `build_env_setup.py` — emits the macOS build flags (`USE_DISTRIBUTED`, deployment target, Metal/CoreML, libomp prefix) to an `--env-out` file the orchestrator sources
- `build_install_deps.py` — pinned build/runtime deps + numpy pin; libomp via Homebrew when not staged
- `build_wheel.py` — sets the arm64 host platform / `ARCHFLAGS` and runs `python -m build --wheel --no-isolation`
- `repair_wheel.py` — delocates the wheel in place (the macOS analog of Linux's `auditwheel`/patchelf; Windows needs no repair)

`build_all_macos_wheels.sh` selects each interpreter and loops, reusing the ABI-free `libtorch_cpu` across Python versions via `SKIP_SETUP_CLEAN` (same incremental-build trick as Linux).

### Notable points

- **macOS is arm64-only.** Main builds no Intel-Mac wheels (the matrix emits only `macos-arm64`), so the pipeline is arm64-only by design — and the dead `x86_64`/`BUILD_PYTHONLESS` libtorch branches in the old `build_wheel.sh` are removed. macOS still ships a libtorch artifact, but it is *extracted from the finished wheel* by a later workflow job (`.ci/libtorch/extract_libtorch_from_wheel.py`), not produced by a separate `BUILD_PYTHONLESS` build.
- **Delocation moves inline** into the per-Python build (`repair_wheel.py`), so the workflow drops its separate "Delocate all wheels" step.
- **Directory renamed** `.ci/wheel/` → `.ci/macwheel/`, parallel to Linux's `.ci/manywheel/` (the old name was too generic for a macOS-only build).
- `build_install_deps.py` uses **`spin clean`** rather than `setup.py clean`, matching Windows and surviving the eventual `setup.py` removal.

### Review order

1. `build.sh` (the stage contract), then the four stage modules
2. `build_all_macos_wheels.sh` and the workflow template
3. The second commit is a pure rename + `spin clean` switch

## Test Plan

Static + structural checks locally:

```
python3 -m py_compile .ci/macwheel/*.py
bash -n .ci/macwheel/build.sh .ci/macwheel/build_all_macos_wheels.sh
python3 .github/scripts/generate_ci_workflows.py   # only the macOS workflow changes
lintrunner .ci/macwheel/* .github/templates/macos_binary_build_workflow.yml.j2
```

A from-source build on a dev Mac exercised the pipeline through environment setup, dependency install, CMake configure, and compilation, confirming the orchestration contract (venv handoff, `--env-out` sourcing, `python -m build` invocation). End-to-end wheel production + delocation is validated by this PR's `ciflow/binaries` run on the `macos-arm64` runner.

Opening as a draft for a first round of CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: pytorch#187944
Approved by: https://github.com/atalman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: releng release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants