Repository navigation
fix(pypi): allow disabling Simple API downloader with index_url = "" - #4376
Open
pganssle-google wants to merge 1 commit into
Open
pganssle-google wants to merge 1 commit into
pganssle-google wants to merge 1 commit into
Conversation
In rules_python 2.0.0, the Simple API downloader was enabled by default by falling back to `https://pypi.org/simple` in `build_config`. While `hub_builder.bzl` retains the fallback to `pip` when `default_index_url` is empty, `pip.default(index_url = "")` could not be used to trigger it because `_configure` ignores falsy attribute values (and `attr.string()` defaults to `""` when omitted). Set the default of `pip.default.index_url` to `"https://pypi.org/simple"` on the tag attribute and record any non-default value (including `""`) in `build_config`. Also apply `envsubst` to `self._config.index_url` in `hub_builder.bzl` so an environment variable that expands to `""` disables the Simple API downloader in the same way as `pip.parse.experimental_index_url`.
Author
|
AI Disclosure: This PR was drafted with an AI coding assistant under human direction ( This is an automatically generated agent comment. |
pganssle-google
commented
Oct 29, 2026
| @@ -0,0 +1,2 @@ | |||
| (pypi) Fixed {obj}`pip.default` so setting `index_url = ""` disables the Simple | |||
Author
There was a problem hiding this comment.
Not sure if this is considered a fix or a behavioral change, let me know.
Collaborator
|
In this particular case, we have spent a lot of effort to ensure that this works in most scenarios. What would be the use case for disabling this? Which version are you observing problems with? What are they? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In rules_python 2.0.0, the Simple API downloader was enabled by default
by falling back to
https://pypi.org/simpleinbuild_config. Whilehub_builder.bzlretains the fallback topipwhendefault_index_urlis empty,
pip.default(index_url = "")could not be used to trigger itbecause
_configureignores falsy attribute values (andattr.string()defaults to
""when omitted).Set the default of
pip.default.index_urlto"https://pypi.org/simple"on the tag attribute and record anynon-default value (including
"") inbuild_config. Also applyenvsubsttoself._config.index_urlinhub_builder.bzlso anenvironment variable that expands to
""disables the Simple APIdownloader in the same way as
pip.parse.experimental_index_url.