fix: add explicit data attribute to compile_pip_requirements and forward it to the generated py_binary#3865
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds an explicit data attribute to the pip_compile macro and forwards it to the generated py_binary. The review feedback suggests defensively normalizing the data parameter to an empty list if it is falsy or None to prevent potential TypeError crashes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…forward it to the generated `py_binary`
35041bf to
71ed30d
Compare
| - "bazel query 'labels(data, //:requirements.update)' | grep -Fx '//:requirements.in'" | ||
| - "bazel query 'labels(data, //:requirements.update)' | grep -Fx '//:requirements_extra.in'" |
There was a problem hiding this comment.
Could we use genquery for this target and not have the integration test at all?
| ) | ||
|
|
||
| data = [name, requirements_txt] + srcs + [f for f in (requirements_linux, requirements_darwin, requirements_windows) if f != None] + constraints | ||
| data = data + [name, requirements_txt] + srcs + [f for f in (requirements_linux, requirements_darwin, requirements_windows) if f != None] + constraints |
There was a problem hiding this comment.
So to better understand how this was not working previously was because we were including the data via the filegroup target via [name, ...] and not directly via files via data?
Out of curiosity, would the usecase have worked if the parameters did not use $(location)?. I would have thought that the files would have been included but the $(location) function in the args would not have worked correctly.
If my analysis is correct, please update the news file to hint about why thee fix was done.
As stated in #3858, the
compile_pip_requirementsmacro accepts adataattribute, but this attribute is not forwarded to the internalpy_binarytarget generated for the.updatetarget.As a result, using
$(location :pip_cert)insideextra_argsfails during analysis because the generatedpy_binarydoes not declare:pip_certas a prerequisite.Before:
After:
Closes #3858