Prefer newest manylinux wheels by sorting expanded platforms#218
Open
eloisekp wants to merge 1 commit intojvolkman:mainfrom
Open
Prefer newest manylinux wheels by sorting expanded platforms#218eloisekp wants to merge 1 commit intojvolkman:mainfrom
eloisekp wants to merge 1 commit intojvolkman:mainfrom
Conversation
Use _platform_sort_key() to order platforms: manylinux_2_N_* by descending N (newest first), then other platforms (linux_, macosx_, etc.). Use this key in _expand_manylinux_platforms() instead of plain sorted(). Pip orders candidates by version, then: existing installs, wheels (ordered via Wheel.support_index_min(self._supported_tags)), then source archives (prefer_binary moves all wheels above sources). Putting the newest manylinux tag first in the platform list therefore influences which wheel is chosen via support_index_min(_supported_tags).
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.
Problem
After switching to rules_pycross, we discovered that some packages (e.g. XGBoost) were resolving to the manylinux2014 wheel instead of the manylinux_2_28 wheel on Linux, which led to slower or less optimal builds when the newer wheel is preferred.
Solution
Sort the expanded platforms so newer manylinux variants come first, and use this key in _expand_manylinux_platforms() instead of sorted(platforms).
Example
With some print debugging while building
xgboostBefore
compute_best_candidatefilters manylinux_2_28 out of being the "best candidate"After
compute_best_candidatechooses manylinux_2_28 as the "best candidate"Note
I'm not sure if something like this covers all edge cases