-
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
22.1: netrc file is only parsed when challenged with HTTP/401 #11113
Comments
Hmm, I think #10998 was totally incorrect, because auth has already prioritized url credentials over .netrc, here pip/src/pip/_internal/network/auth.py Lines 118 to 126 in 0a982f6
Seems, the problem in #10979 was with Google Artifacts Registry #10904 (comment) |
Yeah. I think we need to revive #10904 - but I am waiting for comments from @pradyunsg and other maintainers whether my proposal is good there. It's not really a "problem" of Google Artifact Registry, it's the incompatibility between the way how pypi "/simple" repository was defined in https://peps.python.org/pep-0503/ and it's basic incompatibiity (at least without interpretation) with RFC7617 regarding basic authentication and repositories that can host mutliple projects. Basically PEP 503 missed the fact that authentication will have to be RFC7617 compliant for cases where single domain hosts multiple pip repositories and current implementation will need to be fixed to account for that. The maintainers were busy with 22.1 so i respectfully was not pushing for a quick merge - it's better to do it "well" rather than "quick" that's why I converted it into draft while waiting so that it won't get merged accidentally. But I think the proposal I made with treating "/simple" as special case might work in vast majority of cases. It's not perfect and unless we can somehow figure out the "base" repository URL at the moment we resolve auth, it might work. |
Let's revert #10998 then -- we can figure out the proper fix for it in a follow up. :) |
Can someone file a PR for this? |
sorry not entirely related to this issue but thought it was worth noting for others seeing this issue. One thing I did to get around this was to put the auth in index-url in my
where REGISTRY may look something like ${COMPANY}.jfrog.io/artifactory/api/pypi/pypi/simple |
The problem with putting credentials in the |
Thanks for sharing. I'll revert back to using a .netrc once fixed |
Description
The change in NETRC handling per #10979 may have introduced an unexpected side-effect.
https://github.com/pypa/pip/compare/22.0.4...22.1b1?diff=split
In the current release, netrc is only parsed when the PyPI repo returns an HTTP/401 error due to a change in the method signature's default value from True to False:
And further:
However, some PyPI repositories (such as those by JFrog Artifactory) can return HTTP/404 when auth isn't presented, and HTTP/200 otherwise, like so:
Whereas in 22.0.4:
Expected behavior
Credentials from netrc are used at the first request
pip version
22.1
Python version
3.10.3
OS
macOS 12.4
How to Reproduce
Assumptions:
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: