refactor(pypi): A better error message when the wheel select hits no_match#2519
Merged
aignas merged 6 commits intobazel-contrib:mainfrom Dec 23, 2024
Merged
Conversation
With this change we get the current values of the python configuration
values printed in addition to the message printed previously. This
should help us advise users who don't have their builds configured
correctly.
We are adding an extra `build_setting` which we can set in order to get
an error message instead of a `DEBUG` warning. This has been documented
as part of our config settings and in the `no_match_error` in the
`select` statement.
Example output now
```console
$ bazel cquery --@rules_python//python/config_settings:python_version=3.12 @dev_pip//sphinx
DEBUG: /home/aignas/src/github/aignas/rules_python/python/private/config_settings.bzl:193:14: The current configuration rules_python config flags is:
@@//python/config_settings:pip_whl: "auto"
@@//python/config_settings:pip_whl_glibc_version: ""
@@//python/config_settings:pip_whl_muslc_version: ""
@@//python/config_settings:pip_whl_osx_arch: "arch"
@@//python/config_settings:pip_whl_osx_version: ""
@@//python/config_settings:py_freethreaded: "no"
@@//python/config_settings:py_linux_libc: "glibc"
@@//python/config_settings:python_version: "3.12"
If the value is missing, then the default value is being used, see documentation:
https://rules-python.readthedocs.io/en/latest/api/rules_python/python/config_settings
ERROR: /home/aignas/.cache/bazel/_bazel_aignas/6f0de8c9128ee8d5dbf27ba6dcc48bdd/external/+pip+dev_pip/sphinx/BUILD.bazel:6:12: configurable attribute "actual" in @@+pip+dev_pip//sphinx:_no_matching_repository doesn't match this configuration: No matching wheel for current configuration's Python version.
The current build configuration's Python version doesn't match any of the Python
wheels available for this distribution. This distribution supports the following Python
configuration settings:
//_config:is_cp3.11_py3_none_any
//_config:is_cp3.13_py3_none_any
To determine the current configuration's Python version, run:
`bazel config <config id>` (shown further below)
For the current configuration value see the debug message above that is
printing the current flag values. If you can't see the message, then re-run the
build to make it a failure instead by running the build with:
--@@//python/config_settings:current_config=fail
However, the command above will hide the `bazel config <config id>` message.
This instance of @@+pip+dev_pip//sphinx:_no_matching_repository has configuration identifier 29ffcf8. To inspect its configuration, run: bazel config 29ffcf8.
For more help, see https://bazel.build/docs/configurable-attributes#faq-select-choose-condition.
ERROR: Analysis of target '@@+pip+dev_pip//sphinx:sphinx' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.112s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
```
Fixes bazel-contrib#2466
rickeylev
requested changes
Dec 23, 2024
rickeylev
approved these changes
Dec 23, 2024
Collaborator
rickeylev
left a comment
There was a problem hiding this comment.
LGTM after the discussed changes (add manual tag, revert python_version_flag being public)
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.
With this change we get the current values of the python configuration
values printed in addition to the message printed previously. This
should help us advise users who don't have their builds configured
correctly.
We are adding an extra
build_settingwhich we can set in order to getan error message instead of a
DEBUGwarning. This has been documentedas part of our config settings and in the
no_match_errorin theselectstatement.Example output now
Fixes #2466