-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update python_info aspect to accommodate Python targets that only have rules_python providers #210
base: main
Are you sure you want to change the base?
Conversation
91c7c77
to
cbcfcbe
Compare
It looks like all the e2e tests pass with this change, but I'm seeing a failure in the |
Hi @agluszak - could you give this one another look when you have a chance? Thanks. |
Hi, we've added a new test - could you please merge main for it to pass? |
Updated - looks like the new one is passing.
Thanks - let me know if you find any more specifics (I was able to easily run the other e2e tests locally, but seems the Qodana ones require a token and are a bit harder for me to debug myself). |
we'll get back to you monday on the qodana test |
This is the log from the failing Android test. I'm not 100% sure why it's failing but the test project indeed does not have a dependency on rules_python 2025-02-07T12:42:51.793Z [13336] INFO - �[31m�[1mERROR: �[0mat /root/.cache/bazel/_bazel_idea/d1aa40fbc8d41d43ca12eb8239db2224/external/bazelbsp_aspect/aspects/core.bzl:3:6: at /root/.cache/bazel/_bazel_idea/d1aa40fbc8d41d43ca12eb8239db2224/external/bazelbsp_aspect/aspects/extensions.bzl:3:6: at /root/.cache/bazel/_bazel_idea/d1aa40fbc8d41d43ca12eb8239db2224/external/bazelbsp_aspect/aspects/rules/python/python_info.bzl:4:6: Unable to find package for @@rules_python//python:defs.bzl: The repository '@@rules_python' could not be resolved: Repository '@@rules_python' is not defined. |
load("//aspects:utils/utils.bzl", "create_struct", "file_location", "to_file_location") | ||
#elseif( $bazel7OrAbove == "true" && $bazel8OrAbove == "false") | ||
# Bazel 7: Keep builtin providers available with their original names, and import rules_python providers as secondary. | ||
load("@rules_python//python:defs.bzl", PyInfo_Secondary = "PyInfo", PyRuntimeInfo_Secondary = "PyRuntimeInfo") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this is the line that is failing the test, are you sure this load statement will always succeed?
As the Python rules are gradually phasing out use of the builtin PyInfo provider in favor of the ones from rules_python, there could be cases where a repository is on a Bazel version lower than 8, but the built in PyInfo is still missing from a given target.
In our repo's case, we are in the process of migrating to rules_py, which uses the rules_python providers only (aspect-build/rules_py#311), and not the built in ones.
This change now covers the following scenarios, allowing Bazel 7 repositories to have either the builtin or rules_python providers in their targets: