fix(pipstar): actually pass the extras down the call stack#3468
fix(pipstar): actually pass the extras down the call stack#3468rickeylev merged 1 commit intobazel-contrib:mainfrom
Conversation
It seems that the extras were not correctly passed down the call stack. The upstream code was handling everything correctly and we had unit tests for the downstream code. Fixes bazel-contrib#3352
Summary of ChangesHello @aignas, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where package 'extras' were not being passed down the call stack for pipstar enabled wheels. The change correctly parses the requirement string to extract the extras and passes them to the BUILD file generation logic. My review includes a suggestion to make the handling of extras more robust by filtering out empty values that can result from parsing requirements without any extras specified.
| group_deps = rctx.attr.group_deps, | ||
| group_name = rctx.attr.group_name, | ||
| namespace_package_files = namespace_package_files, | ||
| extras = requirement(rctx.attr.requirement).extras, |
There was a problem hiding this comment.
The requirement function from pep508_requirement.bzl has a characteristic where it returns [''] for requirements that do not specify any extras, instead of an empty list [].
While this might work correctly if the downstream code correctly interprets an empty string as "no extra", it's non-idiomatic and could be brittle. A requirement with no extras should ideally be represented by an empty list.
To make this code more robust, I suggest filtering out any empty strings from the extras list. This ensures that we pass a clean list of extras, which is either empty or contains actual extra names.
| extras = requirement(rctx.attr.requirement).extras, | |
| extras = [e for e in requirement(rctx.attr.requirement).extras if e], |
There was a problem hiding this comment.
This is fine, the downstream code actually has extras or [''].
|
Ran out of time to write an integration test for this one, maybe we can do this as a separate PR? |
rickeylev
left a comment
There was a problem hiding this comment.
Test in a separate PR is sgtm.
All we need is a whl_from_dir with a reauires-dist: extra==bla right?
Test for fix for #3352 implemented in #3468. --------- Co-authored-by: Richard Levasseur <[email protected]>
It seems that the extras were not correctly passed down the call stack.
The upstream code was handling everything correctly and we had unit
tests for the downstream code.
Fixes #3352