Add support to pass --extra-index-url parameter to use both global and hosted PyPI servers
See original GitHub issueHow would this feature be useful?
When internal users of the corporate hosted PyPI need to install a package hosted on the company’s PyPI, they have to have a file with the contents
$ cat ~/.pip/pip.conf
[global]
index-url = https://user:pwd@server.cloud/api/pypi/pypi/simple
extra-index-url = https://pypi.python.org/simple
This file makes it possible to install a package with the pipx install package-name command (the package is hosted on the company’s PyPI but its dependencies are not - they should be taken from the https://pypi.python.org/simple).
However, I am looking for a way to to supply the option to pass the internal PyPI url (either with the pre-filled user:pwd pair or to be prompted to enter user/password) - so that the package of interest is taken from the hosted PyPI but if its dependencies are not found in the internal PyPI, fall back to the global one.
This would remove the need to deploy the configuration files (storing login details / tokens in plain text). The pip does not need any configuration files for this scenario - pip install package-name --extra-index-url https://user:pwd@server.cloud/api/pypi/pypi/simple works fine.
Describe the solution you’d like
Maybe it is already possible to pass this to the pip-args argument, but I haven’t been able to find a way to do this as supplying named arguments does not seem to be supported.
Describe alternatives you’ve considered
Storing a file ~/.pip/pip.conf with the urls to the PyPI servers.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
pipx does support passing arbitrary arguments to pip. This should work:
Would it be acceptable to use environment variables? All pip options can be set that way, see https://pip.pypa.io/en/stable/user_guide/#environment-variables