Skip to content

Commit 8d549f2

Browse files
authored
Merge pull request #8829 from shireenrao/netrc
Add documentation for netrc support
2 parents 71ff8a4 + 8e62239 commit 8d549f2

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

docs/html/user_guide.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,31 @@ as the "username" and do not provide a password, for example -
7979
``https://[email protected]``
8080

8181

82+
netrc Support
83+
-------------
84+
85+
If no credentials are part of the URL, pip will attempt to get authentication credentials
86+
for the URL’s hostname from the user’s .netrc file. This behaviour comes from the underlying
87+
use of `requests`_ which in turn delegates it to the `Python standard library`_.
88+
89+
The .netrc file contains login and initialization information used by the auto-login process.
90+
It resides in the user's home directory. The .netrc file format is simple. You specify lines
91+
with a machine name and follow that with lines for the login and password that are
92+
associated with that machine. Machine name is the hostname in your URL.
93+
94+
An example .netrc for the host example.com with a user named 'daniel', using the password
95+
'qwerty' would look like:
96+
97+
.. code-block:: shell
98+
99+
machine example.com
100+
login daniel
101+
password qwerty
102+
103+
As mentioned in the `standard library docs <https://docs.python.org/3/library/netrc.html>`_,
104+
only ASCII characters are allowed. Whitespace and non-printable characters are not allowed in passwords.
105+
106+
82107
Keyring Support
83108
---------------
84109

@@ -1296,3 +1321,5 @@ announcements on the `low-traffic packaging announcements list`_ and
12961321
.. _low-traffic packaging announcements list: https://mail.python.org/mailman3/lists/pypi-announce.python.org/
12971322
.. _our survey on upgrades that create conflicts: https://docs.google.com/forms/d/e/1FAIpQLSeBkbhuIlSofXqCyhi3kGkLmtrpPOEBwr6iJA6SzHdxWKfqdA/viewform
12981323
.. _the official Python blog: https://blog.python.org/
1324+
.. _requests: https://requests.readthedocs.io/en/master/user/authentication/#netrc-authentication
1325+
.. _Python standard library: https://docs.python.org/3/library/netrc.html

news/7231.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add documentation for '.netrc' support.

0 commit comments

Comments
 (0)