fix(bzlmod pip): ensure that sub-modules do not have invalid repos#1549
Merged
rickeylev merged 2 commits intobazel-contrib:mainfrom Nov 16, 2023
Merged
Conversation
…repos This fixes the cases where the 'default_version' is passed to the 'render_pkg_aliases' utility but the 'default_version' is not present for the wheels. This usually happens when a sub-module is using the 'pip.parse' extension and the default_version can only be set by the root module. Fixes bazel-contrib#1548.
Collaborator
|
An edge case I don't think is being handled: when the default python version is the sub-module's version. Recall that the version-unaware rules (//python:py_binary.bzl) won't match the Then it'll result in an error when it should work. So the logic needs to be something like... |
Collaborator
Author
|
@rickeylev, I think the scenario you are thinking about is covered by https://github.com/bazelbuild/rules_python/pull/1549/files#diff-6b599a1257ef3562418f2372fe871a2a18bbd09517414d6085c87f7f9d994327L75 and it is as you would expect. |
rickeylev
approved these changes
Nov 16, 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 the cases where the 'default_version' is passed to the
'render_pkg_aliases' utility but the 'default_version' is not present
for the wheels. This usually happens when a sub-module is using the
'pip.parse' extension and the default_version can only be set by the
root module.
Previously, such a case would generate a
select()expression that mappedthe default condition to a non-existent target (because the sub-module didn't
call
pip.parse()with that version). This would either result in errorsdue the target not existing, or silently using a target intended for a
different Python version (which may work, but isn't correct to so).
Now, it results in a error via
select.no_match_error.Fixes #1548.