Using multiple PIP indexes on the same hostname with different credentials does not work
See original GitHub issueDescription
I have a need to simultaneously access two PIP indexes from the same hostname (pkgs.dev.azure.com) but using different credentials.
When configuring it like this:
PIP_INDEX_URL=https://build:password1@pkgs.dev.azure.com/feed1
PIP_EXTRA_INDEX_URL=https://build:password2@pkgs.dev.azure.com/feed2
pip seems to try credentials for feed2 for both feed1 and feed2 failing my builds.
I’ve worked around this for now by setting the same credentials for both feeds.
Expected behavior
feed1 credentials are used with feed1 and feed2 credentials are used with feed2
pip version
21.1.3
Python version
3.9
OS
linux
How to Reproduce
- Create two Azure feeds in different organizations, for example pkgs.dev.azure.com/org1/_packaging/org-feed/pypi/simple and pkgs.dev.azure.com/org2/_packaging/org-feed/pypi/simple
- Upload package1 to feed1, package2 to feed2
- Generate different personal access tokens PAT1 and PAT2 for the two feeds
- Set environment variables ``IP_INDEX_URL=https://build:PAT1@pkgs.dev.azure.com/org1/_packaging/org-feed/pypi/simple` and
PIP_EXTRA_INDEX_URL=https://build:PAT2@pkgs.dev.azure.com/org2/_packaging/org-feed/pypi/simple
- Run
pip install package1 package2
Output
pip interactively prompts for username breaking the build instead of installing the two packages.
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (16 by maintainers)
Top Results From Across the Web
Using pip with two --extra-index-url arguments that both point ...
When I try to specify both indices at the same time, I get prompted to log in, but if I use only one...
Read more >User Guide - pip documentation v21.1.dev0
If no credentials are part of the URL, pip will attempt to get authentication credentials for the URL's hostname from the user's .netrc...
Read more >mongodump — MongoDB Database Tools
mongodump is a utility that creates a binary export of a database's contents. mongodump can export data from: Standalone deployments. Replica sets.
Read more >ms-active-directory - PyPI
Python library for integrating with Microsoft Active Directory. ... This is useful when you have multiple different hostnames for a single device, ...
Read more >django-admin and manage.py
It does the same thing as django-admin but also sets the ... Uses the system check framework to inspect the entire Django project...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please to not close this issue.
It affects also users of gitlab where different groups in gitlab have their own package repositories, each using their own credentials.
It used to work, but no longer does (don’t know since what version of pip). It now forces us to use separate requirements files for a single project, since each file basically support one set of credentials.
I’ve only skimmed the discussion, but probably it should be caching anything feed related against the index URL as provided by the caller rather than just the netloc.
I noted this when implementing the keyring interface, and there’s logic somewhere that keeps track of the original index URL leading to a request for this purpose, but I didn’t have a reason to change the netloc-based caching at the time.