refactor(whl_library): move bazel file generation to Starlark#1336
Merged
rickeylev merged 6 commits intobazel-contrib:mainfrom Aug 2, 2023
Merged
Conversation
Collaborator
Author
|
FYI @chrislovecnm, I decided to see how this idea of generating BUILD.bazel and other extra files worked out in reality and I think I am happy with the solution. It makes working on the #1262 and extending the API easier, hence me doing this refactor before extending the |
rickeylev
requested changes
Jul 31, 2023
python/pip_install/private/generate_whl_library_build_bazel.bzl
Outdated
Show resolved
Hide resolved
python/pip_install/private/generate_whl_library_build_bazel.bzl
Outdated
Show resolved
Hide resolved
Before this PR, the `wheel_installer` was doing three things: 1. Downloading the right wheel. 2. Extracting it into the output directory. 3. Generating BUILD.bazel files based on the extracted contents. This PR is moving the third part into the `whl_library` repository rule and it has the following benefits: * We can reduce code duplication and label sanitization functions in rules_python. * There are many things that the `wheel_installer` does not care anymore and we don't need to change less code when extending `whl_library` as we can now do many things in starlark directly. * It becomes easier to change the API of how we expose the generated BUILD.bazel patching because we only need to change the Starlark functions. Work towards bazel-contrib#1330.
9210aea to
d6a7707
Compare
rickeylev
approved these changes
Aug 2, 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.
Before this PR, the
wheel_installerwas doing three things:This PR is moving the third part into the
whl_libraryrepository ruleand it has the following benefits:
rules_python.
wheel_installerdoes not care anymoreand we don't need to change less code when extending
whl_libraryaswe can now do many things in starlark directly.
BUILD.bazel patching because we only need to change the Starlark
functions.
Work towards #1330.