Repository navigation
Fix platform tag selection for wheels built with a build script - #1003
Open
officialpm wants to merge 4 commits into
Open
officialpm wants to merge 4 commits into
officialpm wants to merge 4 commits into
Conversation
Add a static method to select the most specific platform tag for wheels, ensuring compatibility with previous tagging conventions.
Add parameterized test for selecting system tags based on packaging version.
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/poetry/core/masonry/builders/wheel.py" line_range="447" />
<code_context>
+ (PyPI-compatible) platform tag.
+ """
+ return next(
+ (tag for tag in tags if not tag.rpartition("-")[2].startswith("linux_")),
+ tags[0],
+ )
</code_context>
<issue_to_address>
**Native wheels are advertised as universal**
When running on Linux without manylinux or musllinux tags, when `sys_tags()` includes generic `any` tags, `_select_sys_tag` skips native `linux_*` tags and selects a later `*-none-any` tag, so a build-script wheel containing native or architecture-specific outputs is labeled platform-independent and installers offer it on incompatible platforms.
Prefer a native Linux tag when no compatible manylinux or musllinux tag is available, rather than accepting a later `any` tag.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the selection is wrong, the built wheel can carry a platform tag that blocks upload or makes installers treat it as compatible with the wrong systems. Wheels already distributed remain affected after a revert, but they can be yanked and rebuilt with the corrected tag.
Blocking findings: src/poetry/core/masonry/builders/wheel.py:447
Add comments to clarify tag preferences for wheel builds.
This branch has not been deployed
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.
Resolves: python-poetry/poetry#11265
Since
packaging26.3 (vendored in poetry-core 2.5.0), the nativelinux_*platform tag is listed before the more specificmanylinux_*/musllinux_*tags insys_tags()(pypa/packaging#160). BecauseWheelBuilder.tagsimply picked the first tag,poetry buildon a project with a build script now produceslinux_x86_64wheels instead ofmanylinux_*ones, and PyPI rejects those on upload.This restores the previous tag selection by preferring the first tag that is more specific than the native
linux_*tag, falling back to the first tag when no specific tag exists. Behavior on macOS and Windows is unchanged.