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

Support .netrc files #1405

Closed
janbernloehr opened this issue Feb 16, 2024 · 5 comments · Fixed by #2241
Closed

Support .netrc files #1405

janbernloehr opened this issue Feb 16, 2024 · 5 comments · Fixed by #2241
Assignees
Labels
configuration Settings and such registry Related to package indexes and registries

Comments

@janbernloehr
Copy link

pip supports obtaining credentials for authentication from .netrc files. This allows to keep pip.conf, --index-url and --find-links free of credentials and instead store them in a central place in ~/.netrc.

Unfortunately, uv does not support obtaining credentials from there.

This is also required, for e.g. using requirements.txt files that refer to wheels at urls that require auth

torch @ https://foo.org/torch.whl
@zanieb zanieb added configuration Settings and such registry Related to package indexes and registries labels Feb 16, 2024
@zanieb
Copy link
Member

zanieb commented Feb 16, 2024

Thanks for the report! We definitely need to address registry authentication.

@brandon-piner-aruba
Copy link

brandon-piner-aruba commented Feb 16, 2024

We would also like the .netrc support. We specify the private repo in a slightly different way

# From Gemfury (https://pypi.fury.io/the-org/)
# =============================================
some-package
another-package

@framillien
Copy link

framillien commented Feb 16, 2024

@zanieb Since you are using reqwest crate, using reqwest-netrc middleware could be an option ?

@framillien
Copy link

This work for index access, but fail on download since reqwest middleware is not used:
https://github.com/astral-sh/uv/blob/main/crates/uv-client/src/registry_client.rs#L415

@zanieb zanieb self-assigned this Feb 16, 2024
@framillien
Copy link

In fact this is not download in itself that cause this issue, but only the read_metadata_range_request usage. If I activate reqwest-netrc and skip all metada range errors (here) the download succeed.

In my situation, the error we need to skip is an HTTP 401.

charliermarsh pushed a commit that referenced this issue Mar 6, 2024
## Summary

Add netrc support to the uv-client.

closes #1405 

## Test Plan

I've added a corresponding test case to validate the correct header.
Furthermore a tested it against a real world private repository.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such registry Related to package indexes and registries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants