-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option index-url =
for specific commands doesn't set index-url to PyPI
#6131
Comments
Is this related? #5528 It looks like it could be related to a change in how empty strings are processed. |
It looks like this behavior change is a result of this PR ("Add a configuration command"), which first appeared in version 18.1: #4240 You can see that the following lines were introduced in this PR: for section_key, val in self.config.items():
# ignore empty values
if not val:
logger.debug(
"Ignoring configuration key '%s' as it's value is empty.",
section_key
)
continue Here is a link to the line in the PR itself: https://github.com/pypa/pip/pull/4240/files#diff-e3e54473df8cc86ee86078f3eba8a131R161 |
It looks like @cjerdonek's diagnosis is correct. However, I don't think that using an empty value to mean "reset to the default value" has ever been documented or supported behaviour. I'm not saying it's not something useful that maybe we should support, but I'd view it as a new feature, not a bug. (And maybe there's a better way to spell "reset to default" than a blank value). |
Thank you for the explanations.
https://pip.pypa.io/en/stable/user_guide/#config-file says: https://pip.pypa.io/en/stable/reference/pip_download/ says about options: The latter made me think, when I created my
How do I turn this bug report into a feature request? In the meantime, is there any better idea than to change all lines |
We don't really distinguish in the tracker, so it's fine as it is.
Not really, sorry. Although you could switch the logic round and leave (I'm not entirely sure why you'd want to use different index-urls depending on the command, so it's possible there's another way to achieve what you want without hitting this question at all, but that's a separate point). |
I just ran into this after using pip behind a corporate Artifactory acting as a proxy and was able to analyse it a bit better. Interestingly, This in turn means that setting (replaced actual URL)
works for A workaround is to simply specify both
Alas, here comes the fun part when you use the CLI (using an empty config):
My pip version details:
|
IMO it’d be worthwhile to rename |
Yeah, later when I find the time. |
|
@xavfernandez Thank you for doing the research. I'll refrain from opening yet another bug as it would be an exact duplicate of #589. However, I can't tell if that is the same as #395. I have a feeling that after about 9 years there's no chance of getting that fixed anytime soon?! Maybe the documentation should be clearer and indicate these problems. Here's my suggestion:
|
In the
[global]
section of mypip.ini
I set index-url to a non-standard value. In the sections for some commands ([download]
,[list]
,[search]
) I useindex-url =
to reset the index-url for these commands to the standard value (PyPI). Since the last update of my python environment that doesn't work anymore:pip download
tries to access the non-standard index-url given in the[global]
section, not PyPI. The same is true for the version check of pip at the end of the command execution.pip list
tries to access the non-standard index-url given in the[global]
section, not PyPI, for the version check of pip at the end of the command execution.pip search
works as expected.I can reproduce this new and unexpected behaviour with
Everything used to work and still works as expected for
All five configurations mentioned use the same
pip.ini
.I had a look at the release notes of pip 10 and a few of the issues mentioned there. I couldn't find anything that indicates that the change of behaviour is intended.
I also searched the issues for "index-url =", but none of the search results seems to be about the problem I encounter.
Here are some details / examples (pip 18.1, Python 3.7.2, Windows 7):
Here in contrast a version that works (pip 9.0.3, Python 2.7.15, Windows 7, same
pip.ini
as above):The text was updated successfully, but these errors were encountered: