refactor: make python extension generate platform toolchains#2875
Merged
rickeylev merged 1 commit intobazel-contrib:mainfrom May 13, 2025
Merged
Conversation
096a3e2 to
e2c82f2
Compare
Collaborator
Author
|
I want to cross check the generated BUILD files for toolchains to make sure they're the same semantically, so moving back to draft until I do so. From a cursory look, they look OK, but I changed the order of args, prefix length, etc, so the diff is pretty big. Gonna back those out to make it easier to compare them. |
e2c82f2 to
52f2b5d
Compare
Collaborator
Author
|
Manually verified the registrations: they're OK. I tweaked the code a bit so it better matches the original ordering and naming. Ready for review. |
aignas
approved these changes
May 13, 2025
Collaborator
aignas
left a comment
There was a problem hiding this comment.
Outside the scope of this PR, but I would love at some point to start registering the platform values in bazel-mod in the same way that they are done for uv.
aignas
added a commit
that referenced
this pull request
Jun 17, 2025
During the refactor we forgot one more place where the `flag_values` on the platform information was used. They were no longer populated and broke. The solution is to use `selects.config_setting_group` to maintain behaviour and in order to smoke test I have added a target to verify that the aliases work. Fixup to #2875 Fixes #2993
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 17, 2025
During the refactor we forgot one more place where the `flag_values` on the platform information was used. They were no longer populated and broke. The solution is to use `selects.config_setting_group` to maintain behaviour and in order to smoke test I have added a target to verify that the aliases work. Related to #2875 Fixes #2993 Co-authored-by: Richard Levasseur <richardlev@gmail.com>
rickeylev
added a commit
to rickeylev/rules_python
that referenced
this pull request
Jun 17, 2025
…ntrib#3001) During the refactor we forgot one more place where the `flag_values` on the platform information was used. They were no longer populated and broke. The solution is to use `selects.config_setting_group` to maintain behaviour and in order to smoke test I have added a target to verify that the aliases work. Related to bazel-contrib#2875 Fixes bazel-contrib#2993 Co-authored-by: Richard Levasseur <richardlev@gmail.com> (cherry picked from commit 107a878)
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.
This makes the python bzlmod extension handle generating the platform-specific toolchain
entries ("python_3_10_{platform}"). This is to eventually allow adding additional
toolchains that aren't part of the PLATFORMS mapping in versions.bzl and have
their own custom constraints.
The main things this refactor does are:
to create (previously, it relied on
hub_repoto generate the implementationnames).
it (the py_toolchain_suite.user_repository_repo arg) are separate. This allows
future work to mixin toolchains that point to arbitrary repos.
flag values. This allows more arbitrary target settings. For now, flag values
on the platform metadata is still looked for because it's known that users
patch python/versions.bzl.
Along the way:
are public visibility, but actually internal.
Work towards #2081