What's the difference between Python pip's pip.conf and pypirc file?

Multi tool use
What's the difference between Python pip's pip.conf and pypirc file?
I'm having trouble reaching a nexus server that we're using to store custom python packages. I've been told to change the settings in both my ~/.pypirc
file and the ~/.pip/pip.conf
file.
~/.pypirc
~/.pip/pip.conf
What's the difference between those two files in how they're used? It seems like the pip install -r requirements.txt
command refers to the pip.conf
file, and then the fields within the pip.conf
file requires looking up the pypirc file?
pip install -r requirements.txt
pip.conf
pip.conf
Example pip.conf file:
[global]
index = https://user:password@someurl.com/somerepo/pypi-group/pypi
index-url = index = https://user:password@someurl.com/somerepo/pypi-group/simple
Example pypirc file:
[distutils]
index-servers =
pypi
nexus
[pypi]
repository: https://pypi.org/pypi
username: abc
password: def
[nexus]
repository: https://someurl.com/somerepo/pypi-internal
username: someuser
password: somepassword
Also, what's the difference between index and index-url in the pip.conf file?
1 Answer
1
.pypirc
is a file standard used by multiple tools, not just pip
. For example, the easy_install
tool also reads that file. It contains configuration on how to access specific repositories
.pypirc
pip
easy_install
pip.conf
on the other hand is only used by the pip
tool. It may use information from .pypirc
if authentication is needed when installing from a specific PyPI index server.
pip.conf
pip
.pypirc
However, the .pypirc
file is more commonly consulted when publishing packages, not when installing.
.pypirc
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.