Skip to content

Align generate_requirements.sh better with WORKSPACE - #1143

Open
mhucka wants to merge 2 commits into
masterfrom
improve-generate-requirements
Open

mhucka wants to merge 2 commits into
masterfrom
improve-generate-requirements

Conversation

@mhucka

@mhucka mhucka commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

The invocations of pip in ./scripts/generate_requirements.sh where not as well isolated from the environment as the Bazel rules in WORKSPACE. This could lead to the host environment unexpectedly affecting the requirements.txt files generated by the script, as well as baffling run-time failures to get the expected versions of some transitive dependencies.

This PR changes generate_requirements.sh to (1) set the PyPI index:(like WORKSPACE does), (2) prevent any trusted-host settings in /etc/pip.conf from leaking into requirements.txt`, and (3) ignore PIP variable settings. This makes the script produce more predictable requirements files.

The invocations of `pip` in `./scripts/generate_requirements.sh` where
not as well isolated from the environment as the Bazel rules in
`WORKSPACE`. This could lead to the host environment unexpectedly
affecting the `requirements.txt` files generated by the script.

This PR changes `generate_requirements.sh` to (1) set the PyPI
index:(like `WORKSPACE` does), (2) prevent any `trusted-host` settings
in `/etc/pip.conf from leaking into `requirements.txt`, and (3) ignore
PIP variable settings. This makes the script produce more predictable
requirements files.
@mhucka
mhucka marked this pull request as ready for review November 20, 2026 03:27

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the generate_requirements.sh script to ensure deterministic dependency resolution by unsetting local PIP_* environment variables, setting PIP_CONFIG_FILE=/dev/null, and explicitly configuring PyPI as the index URL. The review feedback recommends replacing the use of compgen with native Bash parameter expansion (${!PIP_@}) to unset the variables, which improves robustness and compatibility in minimal environments.

Comment thread scripts/generate_requirements.sh Resolved
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant