Skip to content

GH-50531: [Python][Packaging] Set macOS deployment target before building wheel platform tag#50377

Draft
anxkhn wants to merge 1 commit into
apache:mainfrom
anxkhn:fix/macos-wheel-deployment-target-order
Draft

GH-50531: [Python][Packaging] Set macOS deployment target before building wheel platform tag#50377
anxkhn wants to merge 1 commit into
apache:mainfrom
anxkhn:fix/macos-wheel-deployment-target-order

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 5, 2026

Copy link
Copy Markdown

Rationale for this change

ci/scripts/python_wheel_macos_build.sh builds _PYTHON_HOST_PLATFORM from MACOSX_DEPLOYMENT_TARGET before applying its default. If the script is run without that variable exported, it produces a malformed macosx--<arch> tag even though the build then targets macOS 12.0.

Closes #50531.

What changes are included in this PR?

Apply the MACOSX_DEPLOYMENT_TARGET default before deriving _PYTHON_HOST_PLATFORM. Existing CI invocations that already set the deployment target are unchanged.

Are these changes tested?

bash -n passes. I also checked the relevant assignments with the variable unset and explicitly set: the unset case now produces macosx-12.0-x86_64, while an explicit target remains unchanged. A full wheel build was not run.

Are there any user-facing changes?

No API changes. Manual or local wheel builds that rely on the default now receive a valid platform tag.

This change was made with help from an AI coding assistant. I reviewed and verified the one-line ordering fix.

Copilot AI review requested due to automatic review settings July 5, 2026 21:42
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@github-actions github-actions Bot added the awaiting review Awaiting review label Jul 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a macOS wheel packaging issue where _PYTHON_HOST_PLATFORM could be derived from an unset MACOSX_DEPLOYMENT_TARGET, producing a malformed wheel platform tag during manual/local builds.

Changes:

  • Set MACOSX_DEPLOYMENT_TARGET (with its default) before exporting _PYTHON_HOST_PLATFORM so the platform tag is always derived from the resolved value.

@kou
kou marked this pull request as draft July 6, 2026 00:58
@kou

kou commented Jul 6, 2026

Copy link
Copy Markdown
Member

Could you open an issue for this.
See also: https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes

@anxkhn anxkhn changed the title [Python][Packaging] Set MACOSX_DEPLOYMENT_TARGET default before building wheel platform tag GH-50531: [Python][Packaging] Set macOS deployment target before building wheel platform tag Jul 17, 2026
@anxkhn

anxkhn commented Jul 17, 2026

Copy link
Copy Markdown
Author

Opened #50531 as requested and updated this PR title and description to link it and follow the contribution format. Thank you for pointing me to the minor-fix policy.

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50531 has been automatically assigned in GitHub to PR creator.

…ing wheel platform tag

In ci/scripts/python_wheel_macos_build.sh the wheel platform tag
_PYTHON_HOST_PLATFORM was assembled from MACOSX_DEPLOYMENT_TARGET one line
before that variable's :-12.0 default was applied. When the script runs
without MACOSX_DEPLOYMENT_TARGET already exported (for example a manual or
local macOS build), the interpolation yields a malformed tag with an empty
version component (macosx--<arch>), while the C++ libraries and the wheel are
actually built for 12.0. That produces an inconsistent, invalid platform tag
on the built wheel.

Swap the two lines so the default is set first and the platform tag is derived
from the resolved value. When MACOSX_DEPLOYMENT_TARGET is already set (as in
the packaging CI, which exports it as a top-level env var), the output is
unchanged, so there is no behavior change for existing jobs.

Verified the two lines in isolation with the variable unset: before the change
_PYTHON_HOST_PLATFORM=macosx--x86_64, after the change macosx-12.0-x86_64. The
full macOS wheel build was not run (no Arrow C++ toolchain available locally).
@anxkhn
anxkhn force-pushed the fix/macos-wheel-deployment-target-order branch from fe42499 to a3b3ef1 Compare July 17, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review Awaiting review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python][Packaging] macOS wheel platform tag is malformed when deployment target is unset

3 participants