FIX: Produce universal2 wheel for Python 3.10 on macOS#542
Merged
Conversation
- setup.py: set plat_name BEFORE parent finalize_options() so plat_name_supplied=True and get_tag() uses our explicit macosx_15_0_universal2 tag instead of inspecting Mach-O binaries - OneBranch pipeline: install universal2 Python 3.10.11 from python.org for macOS builds (UsePythonVersion@0 only provides darwin-x64 for 3.10) - Dev pipeline: same conditional install for py310 macOS matrix entry
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the macOS wheel build process to ensure Python 3.10 uses a universal2 interpreter in CI, and adjusts wheel tagging logic to prevent macOS wheels from being incorrectly tagged as x86_64.
Changes:
- Install Python 3.10 universal2 from python.org in macOS build pipelines (instead of
UsePythonVersion@0) for 3.10 jobs. - Adjust
CustomBdistWheel.finalize_options()to setplat_namebefore invoking the parent implementation so wheel tagging respects the intended macOS platform tag. - Add diagnostics to confirm the Python interpreter architecture used during the build.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
setup.py |
Sets plat_name prior to parent finalize_options() to avoid tag downgrades on macOS. |
eng/pipelines/build-whl-pipeline.yml |
Installs python.org Python 3.10 universal2 for macOS wheel jobs and prepends it to PATH. |
OneBranchPipelines/stages/build-macos-single-stage.yml |
Mirrors the Python 3.10 universal2 installation approach in the OneBranch macOS stage template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 67.9%
mssql_python.row.py: 70.5%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 74.6%
mssql_python.pybind.connection.connection.cpp: 76.2%
mssql_python.__init__.py: 77.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 85.3%🔗 Quick Links
|
…epip - Verify .pkg signature via pkgutil before installing (supply-chain safety) - Use sudo ln -sf for symlinks under /Library/Frameworks - Add ensurepip + pip symlink so pip commands resolve correctly - Document why 3.10.11 is pinned (last version with macOS binary installers per PEP 619)
saurabh500
reviewed
Apr 27, 2026
….org - Add install-python-310-macos.sh that downloads from mssql-rs_Public feed - Add eng/versions/python-310-macos.version (pinned to 1.0.0) - Verify SHA-256 + Apple code signature (Ned Deily) before install - Fix SSL certificates for python.org macOS installer - Update both pipelines to call the script for py3.10
bewithgaurav
requested changes
Apr 29, 2026
…etup.py to original (plat_name after finalize_options) - Revert build-whl-pipeline.yml to unconditional UsePythonVersion - Revert OneBranch stage to unconditional UsePythonVersion - Add 'wheel tags --platform-tag macosx_15_0_universal2' retag step - Remove install-python-310-macos.sh and python-310-macos.version - Same approach used in mssql-tds Rust pipeline
saurabh500
approved these changes
Apr 29, 2026
bewithgaurav
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
This pull request updates the build pipelines to improve the handling of Python wheel platform tags on macOS, especially for universal2 builds. The main focus is ensuring that the built wheel files are correctly tagged as universal2, even when the Python interpreter used is x86_64-only, and simplifying display names for Python version tasks.
Python wheel platform tagging improvements:
build-macos-single-stage.ymlto retag built wheel files with themacosx_15_0_universal2platform tag, ensuring proper universal2 compatibility regardless of the Python interpreter architecture. This addresses cases wherebdist_wheelmight produce an x86_64-only tag even though the binary is universal2.Pipeline task display name simplification:
displayNameforUsePythonVersion@0tasks in bothbuild-macos-single-stage.ymlandbuild-whl-pipeline.ymlto remove the "(Universal2)" suffix, making the display names clearer and less misleading when the interpreter is not universal2.