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

An invalid netrc file does not produce a warning #7685

Closed
mathialo opened this issue Sep 25, 2024 · 1 comment · Fixed by #8364
Closed

An invalid netrc file does not produce a warning #7685

mathialo opened this issue Sep 25, 2024 · 1 comment · Fixed by #8364
Labels
error messages Messaging when something goes wrong help wanted Contribution especially encouraged tracing Verbose output and debugging

Comments

@mathialo
Copy link

I recently migrated one of our projects from poetry to uv, and one thing that made me stumble was a syntax error in my netrc file. Uv would just silently ignore the error and move on as if the netrc file did not exist, which made it a bit hard to figure out what was going on.

I think a better approach would be if the Netrc::new() call returns a parsing error, to log a warning about it before ignoring it, to let users know why the netrc file is being ignored.

@zanieb zanieb added error messages Messaging when something goes wrong tracing Verbose output and debugging labels Sep 25, 2024
@zanieb
Copy link
Member

zanieb commented Sep 25, 2024

Seems reasonable, but we'd want to be careful to only display this once and only if we needed credentials.

@zanieb zanieb added the help wanted Contribution especially encouraged label Sep 25, 2024
MtkN1 pushed a commit to MtkN1/uv that referenced this issue Oct 21, 2024
## Summary

Resolves astral-sh#7685

## Test Plan

```console
$ echo "this is an invalid netrc" > .netrc
$ NETRC=.netrc cargo run -- pip install anyio --index-url https://pypi-proxy.fly.dev/basic-auth/simple --strict -v
DEBUG uv 0.4.24 (f4d5fba 2024-10-19)
DEBUG Searching for default Python interpreter in system path or `py` launcher
DEBUG Found `cpython-3.11.2-windows-x86_64-none` at `D:\Projects\Rust\uv\.venv\Scripts\python.exe` (virtual environment)
DEBUG Using Python 3.11.2 environment at .venv
DEBUG Acquired lock for `.venv`
DEBUG At least one requirement is not satisfied: anyio
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.11.2
DEBUG Solving with target Python version: >=3.11.2
DEBUG Adding direct dependency: anyio*
DEBUG No cache entry for: https://pypi-proxy.fly.dev/basic-auth/simple/anyio/
WARN Error reading netrc file: parsing error: bad toplevel token 'this' (line 1) in the file '.netrc'
DEBUG Searching for a compatible version of anyio (*)
DEBUG No compatible version found for: anyio
  × No solution found when resolving dependencies:
  ╰─▶ Because anyio was not found in the package registry and you require anyio, we can conclude that your
      requirements are unsatisfiable.

      hint: An index URL (https://pypi-proxy.fly.dev/basic-auth/simple) could not be queried due to a lack of valid
      authentication credentials (401 Unauthorized).
DEBUG Released lock at `D:\Projects\Rust\uv\.venv\.lock`
error: process didn't exit successfully: `target\debug\uv.exe pip install anyio --index-url https://pypi-proxy.fly.dev/basic-auth/simple --strict -v` (exit code: 1)

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong help wanted Contribution especially encouraged tracing Verbose output and debugging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants