fix(py_runtime): make py_runtime_pair return builtin PyRuntimeInfo under Bazel 6; make python_bootstrap_template public#1611
Merged
aignas merged 3 commits intobazel-contrib:mainfrom Dec 14, 2023
Conversation
e020118 to
ff9121e
Compare
With Bazel 6, the `py_binary` rule performs a type check of the PyRuntimeInfo value it gets from the toolchain to verify it is an instance of the Java-implemented PyRuntimeInfo class. This type check fails when the provider is implemented in rules_python in Starlark. To fix, make the `py_runtime_info` prefer the builtin PyRuntimeInfo provider when running under Bazel 6. The two providers are (currently) the same, so are mostly interchangable. This satisfies the type check that `py_binary` performs. Fixes bazel-contrib#1610
ff9121e to
f67fca5
Compare
aignas
approved these changes
Dec 14, 2023
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 fixes two bugs from #1574:
used outside rules_python itself (e.g. in the python toolchain repos)
With Bazel 6, the
py_binaryrule performs a type check of the PyRuntimeInfo value it gets from the toolchain to verify it is an instance of the Java-implemented PyRuntimeInfo class. This type check fails when the provider is implemented in rules_python in Starlark.To fix, make the
py_runtime_infoprefer the builtin PyRuntimeInfo provider when running under Bazel 6. The two providers are (currently) the same, so are mostly interchangable. This satisfies the type check thatpy_binaryperforms.py_runtimeas an implicit dependency on//python/private:python_bootstrap_template.txt,but that target is only visible to rules python itself. This means the py_runtime targets
created in the toolchain repos fail. To fix, make the file public.
Fixes #1610