Skip to content
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

Miss match between coverage tool attribute type between single_version_platform_override and python_repository #2570

Open
ewianda opened this issue Jan 21, 2025 · 1 comment

Comments

@ewianda
Copy link
Contributor

ewianda commented Jan 21, 2025

🐞 bug report

Is this a regression?

No

Description

"coverage_tool": attr.label(
doc = """\
The coverage tool to be used for a particular Python interpreter. This can override
`rules_python` defaults.
""",

"coverage_tool": attr.string(

🔬 Minimal Reproduction

python.single_version_platform_override(
    coverage_tool = "//benchsci/devtools/python:coverage_main",
    platform = "x86_64-unknown-linux-gnu",
    python_version = "3.11.6",
)

🔥 Exception or Error

Computing main repo mapping:
ERROR: <builtin>: @@rules_python~//python/extensions:rules_python~~python~python_3_11_6_x86_64-unknown-linux-gnu: expected value of type 'string' for attribute 'coverage_tool' in 'python_repository' rule, but got Label("//benchsci/devtools/python:coverage_main") (Label)
ERROR: Traceback (most recent call last):
 File "/home/ewianda/.cache/bazel/_bazel_ewianda/da4b4cc49e0e621570c9e24d6f1eab95/external/rules_python~/python/private/python.bzl", line 232, column 75, in _python_impl
loaded_platforms[full_python_version] = python_register_toolchains(
File "/home/ewianda/.cache/bazel/_bazel_ewianda/da4b4cc49e0e621570c9e24d6f1eab95/external/rules_python~/python/private/python_register_toolchains.bzl", line 133, column 26, in python_register_toolchains
python_repository(
Error in repository_rule: failed to instantiate 'python_repository' from this module extension
ERROR: @rules_python//python/config_settings:bootstrap_impl :: Error loading option @rules_python//python/config_settings:bootstrap_impl: error evaluating module extension python in @@rules_python~//python/extensions:python.bzl    
@rickeylev
Copy link
Collaborator

I ran across this code this evening. The doc string of the python_repository.coverage_tool attribute say it's intentionally a string. My guess is what's missing is python.bzl needs to call str() on the Label before it passes it along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants