feat(pip): global downloader settings by aignas · Pull Request #3322 · bazel-contrib/rules_python
use [
index_urlspecified in the lock file] as extra index_urls
I fear that this would risk package name collisions and would be difficult to figure out the index ordering.
Use them and ignore the default that we set.
This sounds reasonable to me, but then a root module will not be able to override a child module's config (which I believe is a desired feature) without adjusting the child's requirements.txt directly:
./MODULE.bazel # sets pip.default(downloader = "enabled", index_url = BAR)
./requirements.txt # sets --index-url FOO
./child_module/
MODULE.bazel # sets pip.default(downloader = "enabled", index_url = AAA)
requirements.txt # sets --index-url BAD
If we ignore pip.default, the root MODULE.bazel will pull from FOO and the child will pull from BAD. Right?
Use PyPI as a fallback which gets used if else fails.
If I set index_url in any of my requirements.txt files, I do not want pypi used at all.
$ head requirements.txt
# This file was autogenerated by uv via the following command:
# uv pip compile --python-version=3.12 --output-file=requirements.txt requirements.in
--index-url https://oauth2accesstoken@us-python.pkg.dev/REDACTED/simple
--extra-index-url https://oauth2accesstoken@us-west2-python.pkg.dev/REDACTED/simple
absl-py==2.3.0 \
for PEP751 lock files the index is there always (I think).
It's optional 😞
I think it's reasonable to put all index config in Bazel and completely ignore any index config set in requirements.txt or PEP751 pylock.toml files.