-
-
Notifications
You must be signed in to change notification settings - Fork 677
Closed
Description
🐞 bug report
Is this a regression?
probably not
Description
A clear and concise description of the problem...🔬 Minimal Reproduction
Just use this repo:
File: BUILD.bazel
1 load("@python_versions//3.12:defs.bzl", "py_binary")
2 #load("@rules_python//python:defs.bzl", "py_binary")
3
4 py_binary(
5 name = "main",
6 srcs = ["main/main.py"],
7 )
File: MODULE.bazel
1 bazel_dep(
2 name = "rules_python",
3 version = "0.34.0",
4 )
5
6 python = use_extension("@rules_python//python/extensions:python.bzl", "python")
7 python.toolchain(
8 python_version = "3.12",
9 )
10 use_repo(python, "python_versions")
File: main/main.py <EMPTY>
🔥 Exception or Error
The BUILD.bazel file contains two different load statements. Depending on which one is enabled, a different set of providers is exposed
When "@rules_python//python:defs.bzl" is on, you get
% bazelisk cquery --output=starlark --starlark:expr="providers(target).keys()" //:main
INFO: Analyzed target //:main (2 packages loaded, 4 targets configured).
INFO: Found 1 target...
["LicenseInfo", "InstrumentedFilesInfo", "RunEnvironmentInfo", "@@rules_python~//python/private/common:providers.bzl%PyRuntimeInfo", "@@_builtins//:common/python/providers.bzl%PyRuntimeInfo", "@@rules_python~//python/private/common:providers.bzl%PyCcLinkParamsProvider", "@@rules_python~//python/private/common:providers.bzl%PyInfo", "@@_builtins//:common/python/providers.bzl%PyInfo", "FileProvider", "FilesToRunProvider", "OutputGroupInfo"]
INFO: Elapsed time: 0.477s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
on the other hand, when "@python_versions//3.12:defs.bzl" is, you get
% bazelisk cquery --output=starlark --starlark:expr="providers(target).keys()" //:main
INFO: Analyzed target //:main (63 packages loaded, 1010 targets configured).
INFO: Found 1 target...
["LicenseInfo", "@@rules_python~//python/private/common:providers.bzl%PyInfo", "@@rules_python~//python/private/common:providers.bzl%PyRuntimeInfo", "InstrumentedFilesInfo", "RunEnvironmentInfo", "FileProvider", "FilesToRunProvider", "OutputGroupInfo"]
INFO: Elapsed time: 0.492s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
Unfortunately, the latter one doesn't contain "@@rules_python~//python/private/common:providers.bzl%PyInfo", hence in IntelliJ we can't recognize it as a python target.
Screen.Recording.2024-08-09.at.09.54.53.mov
🌍 Your Environment
Operating System:
Fedora
Output of bazel version:
7.2.1
Rules_python version:
0.34
Anything else relevant?
"@python_versions//3.12:defs.bzl" seems to provide an extra target, named //:_main` which contains the expected providers
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels