From da72043975a377c46a73ed4fbf5f541d6a1db58a Mon Sep 17 00:00:00 2001 From: mhucka Date: Fri, 20 Nov 2026 02:32:39 +0000 Subject: [PATCH 1/2] Align generate_requirements.sh better with WORKSPACE 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. --- scripts/generate_requirements.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/generate_requirements.sh b/scripts/generate_requirements.sh index 33cac4176..7f186af6d 100755 --- a/scripts/generate_requirements.sh +++ b/scripts/generate_requirements.sh @@ -33,6 +33,14 @@ then exit 1 fi +# Ignore local/system pip config files and PIP_* overrides (e.g., mirrors that +# omit PEP 503 data-requires-python attributes) so pip and pip-compile resolve +# deterministically against public PyPI, matching WORKSPACE's pip_parse setup. +while IFS= read -r var; do + unset "${var}" +done < <(compgen -v PIP_ || true) +export PIP_CONFIG_FILE=/dev/null + if ! python -m pip show -qq pip-tools; then echo "Error: 'pip-compile' not found. Please install 'pip-tools'." >&2 exit 1 @@ -46,16 +54,18 @@ if [[ -e "${pins_file}" ]]; then fi # Have pip-compile mention this script in the requirements.txt header it writes. -export CUSTOM_COMPILE_COMMAND="${0}" +export CUSTOM_COMPILE_COMMAND="./scripts/generate_requirements.sh" echo "Running pip-compile in ${repo_dir} …" python -m piptools compile -q \ + --index-url https://pypi.org/simple/ \ --allow-unsafe \ --upgrade \ --rebuild \ --generate-hashes \ --no-strip-extras \ --no-emit-index-url \ + --no-emit-trusted-host \ -o requirements.txt \ "${constraints[@]}" From b8e85a04d178adf6d8085e283c760439ea04e999 Mon Sep 17 00:00:00 2001 From: Michael Hucka Date: Thu, 19 Nov 2026 19:31:57 -0800 Subject: [PATCH 2/2] Apply a good suggestion from GCA Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- scripts/generate_requirements.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generate_requirements.sh b/scripts/generate_requirements.sh index 7f186af6d..869493757 100755 --- a/scripts/generate_requirements.sh +++ b/scripts/generate_requirements.sh @@ -36,9 +36,9 @@ fi # Ignore local/system pip config files and PIP_* overrides (e.g., mirrors that # omit PEP 503 data-requires-python attributes) so pip and pip-compile resolve # deterministically against public PyPI, matching WORKSPACE's pip_parse setup. -while IFS= read -r var; do +for var in "${!PIP_@}"; do unset "${var}" -done < <(compgen -v PIP_ || true) +done export PIP_CONFIG_FILE=/dev/null if ! python -m pip show -qq pip-tools; then