How 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:[email protected]/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:[email protected]/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.
What鈥檚 wrong with pip install package-name --index-url https://user:[email protected]/api/pypi/pypi/simple --extra-index-url https://pypi.org/simple?
What鈥檚 wrong with
pip install package-name --index-url https://user:[email protected]/api/pypi/pypi/simple --extra-index-url https://pypi.org/simple?
Nothing wrong :) it works fine as I said but I want to use pipx, not pip.
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
pipx does support passing arbitrary arguments to pip. This should work:
pipx install package-name --pip-args='--index-url https://user:[email protected]/api/pypi/pypi/simple --extra-index-url https://pypi.org/simple'
pipx does support passing arbitrary arguments to pip. This should work:
pipx install package-name --pip-args='--index-url https://user:[email protected]/api/pypi/pypi/simple --extra-index-url https://pypi.org/simple'
I haven't realized you'd pass the arguments as a string, now it all works great, many thanks.
Most helpful comment
pipx does support passing arbitrary arguments to pip. This should work: