Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that NETRC environment variable is supported #11023

Open
1 task done
wwuck opened this issue Apr 11, 2022 · 7 comments
Open
1 task done

Document that NETRC environment variable is supported #11023

wwuck opened this issue Apr 11, 2022 · 7 comments
Labels
state: awaiting PR Feature discussed, PR is needed type: docs Documentation related

Comments

@wwuck
Copy link

wwuck commented Apr 11, 2022

What's the problem this feature will solve?

I was reading through the pip documentation for .netrc support and it doesn't appear to mention if there is any support for the NETRC environment variable.

It does say the .netrc support comes from requests and the stdlib netrc module but there is no documentation for NETRC environment variable in either the stdlib netrc docs or requests docs.

I did find a pull request in requests psf/requests#5643 which implements support for NETRC environment variable so I'm guessing that it also applies to pip?

Describe the solution you'd like

I would like to see the pip docs clarify whether or not the NETRC environment variable is supported for the pip netrc authentication.

Alternative Solutions

I can submit a PR to update pip docs if this NETRC support is clarified.

Additional context

The only documentation reference I can find anywhere mentioning NETRC is in the ftp documentation linked from the pip docs at https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html but obviously that doesn't apply to anything python-related.

Code of Conduct

@wwuck wwuck added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Apr 11, 2022
@wwuck
Copy link
Author

wwuck commented Apr 11, 2022

I can now see the docs update for requests mentions finding the netrc file at ~/.netrc, ~/_netrc and from NETRC environment variable. Is the ~/_netrc path supported on linux or is that only for Windows?

@uranusjr
Copy link
Member

I believe _netrc is only for Windows (because in some versions of Windows you cannot start a filename with .). You should stick to .netrc if possible though.

@wwuck
Copy link
Author

wwuck commented Apr 11, 2022

I'm planning on trying to use it in a Jenkins CI pipeline where I don't have access to ~/.netrc and will be temporarily copying the file out of the Jenkins credential store, so NETRC support is essential here.

@q0w
Copy link
Contributor

q0w commented Apr 11, 2022

I've used NETRC env for testing recently #10998

@pradyunsg pradyunsg removed type: feature request Request for a new feature S: needs triage Issues/PRs that need to be triaged labels Apr 11, 2022
@pradyunsg pradyunsg changed the title Add support for NETRC environment variable to docs Document that NETRC environment variable is supported Apr 11, 2022
@pradyunsg pradyunsg added type: docs Documentation related state: awaiting PR Feature discussed, PR is needed labels Apr 11, 2022
@notatallshaw
Copy link
Member

notatallshaw commented Apr 12, 2022

I was worried this was requests specific behavior because it was only added to requests fairly recently but it seems httpx also supports it so hopefully it's commonly agreed upon for HTTP libraries:

@pfmoore
Copy link
Member

pfmoore commented Apr 12, 2022

Even so, I think this is covered by our comment that our network support is handled by requests. If it's not covered clearly enough in the requests documentation, then maybe you could ask there for it to be improved?

@notatallshaw
Copy link
Member

As per the PR I linked above it seems to be documented in request's quickstart guide: https://docs.python-requests.org/en/latest/user/quickstart/#custom-headers

I wish the logic of how a netrc file was sourced and parsed was included in a specific netrc location like here: https://2.python-requests.org/en/master/user/authentication/#netrc-authentication (as this is the location when you search for "netrc" in their docs search and the quickstart guide doesn't appear at all). But that's just a wish, I can't contribute PRs right now until I've come to an agreement with my current employer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: awaiting PR Feature discussed, PR is needed type: docs Documentation related
Projects
None yet
Development

No branches or pull requests

6 participants