Skip to content

FIX: Produce universal2 wheel for Python 3.10 on macOS#542

Merged
jahnvi480 merged 7 commits intomainfrom
jahnvi/3.10macOSwheel
Apr 30, 2026
Merged

FIX: Produce universal2 wheel for Python 3.10 on macOS#542
jahnvi480 merged 7 commits intomainfrom
jahnvi/3.10macOSwheel

Conversation

@jahnvi480
Copy link
Copy Markdown
Contributor

@jahnvi480 jahnvi480 commented Apr 27, 2026

Work Item / Issue Reference

AB#43809

GitHub Issue: #496


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:

  • Added a script step in build-macos-single-stage.yml to retag built wheel files with the macosx_15_0_universal2 platform tag, ensuring proper universal2 compatibility regardless of the Python interpreter architecture. This addresses cases where bdist_wheel might produce an x86_64-only tag even though the binary is universal2.

Pipeline task display name simplification:

  • Updated the displayName for UsePythonVersion@0 tasks in both build-macos-single-stage.yml and build-whl-pipeline.yml to remove the "(Universal2)" suffix, making the display names clearer and less misleading when the interpreter is not universal2.

- 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
Copilot AI review requested due to automatic review settings April 27, 2026 09:10
@jahnvi480 jahnvi480 changed the title Fix: Produce universal2 wheel for Python 3.10 on macOS FIX: Produce universal2 wheel for Python 3.10 on macOS Apr 27, 2026
@github-actions github-actions Bot added the pr-size: small Minimal code update label Apr 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 set plat_name before 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.

Comment thread eng/pipelines/build-whl-pipeline.yml Outdated
Comment thread eng/pipelines/build-whl-pipeline.yml Outdated
Comment thread OneBranchPipelines/stages/build-macos-single-stage.yml Outdated
Comment thread OneBranchPipelines/stages/build-macos-single-stage.yml Outdated
Comment thread eng/pipelines/build-whl-pipeline.yml Outdated
Comment thread OneBranchPipelines/stages/build-macos-single-stage.yml Outdated
Comment thread eng/pipelines/build-whl-pipeline.yml Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

79%


📈 Total Lines Covered: 6860 out of 8636
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No 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

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

…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)
@github-actions github-actions Bot added pr-size: medium Moderate update size and removed pr-size: small Minimal code update labels Apr 27, 2026
Comment thread eng/pipelines/build-whl-pipeline.yml Outdated
….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
Comment thread eng/scripts/install-python-310-macos.sh Fixed
Comment thread eng/scripts/install-python-310-macos.sh Fixed
Comment thread eng/scripts/install-python-310-macos.sh Fixed
Comment thread eng/scripts/install-python-310-macos.sh Fixed
Comment thread eng/pipelines/build-whl-pipeline.yml Outdated
Comment thread OneBranchPipelines/stages/build-macos-single-stage.yml Outdated
Comment thread OneBranchPipelines/stages/build-macos-single-stage.yml
Comment thread setup.py Outdated
…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
@github-actions github-actions Bot added pr-size: small Minimal code update and removed pr-size: medium Moderate update size labels Apr 29, 2026
@jahnvi480 jahnvi480 requested a review from bewithgaurav April 29, 2026 14:20
@jahnvi480 jahnvi480 merged commit 00ea71c into main Apr 30, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: small Minimal code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants