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

Continue on client errors when fetching wheel metadata #12255

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Mar 18, 2025

Summary

This PR allows the resolver to continue (backtrack) when wheel metadata fetches fail due to a client error (like a 403). We may want this to be opt-in?

Closes #5260.

If all distributions can't be fetched, you get something like this:

  × No solution found when resolving dependencies:
  ╰─▶ Because all versions of flask could not be fetched from the network (`404 Not Found`) and you require flask, we
      can conclude that your requirements are unsatisfiable.

      hint: Pre-releases are available for `flask` in the requested range (e.g., 2.0.0rc2), but pre-releases weren't
      enabled (try: `--prerelease=allow`)

      hint: Metadata for `flask` (v3.1.0) could not be fetched; the server returned: `404 Not Found`

Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, slight preference for making this opt-in

@charliermarsh
Copy link
Member Author

I need to see what this looks like when you fail to authenticate with all wheels for a given server.

@charliermarsh charliermarsh marked this pull request as ready for review March 18, 2025 20:50
@zanieb
Copy link
Member

zanieb commented Mar 18, 2025

Can we make this an opt-in setting per index? I'm not sure what to call it yet.

@charliermarsh
Copy link
Member Author

Oh no, a name...

hint: Pre-releases are available for `anyio` in the requested range (e.g., 4.0.0rc1), but pre-releases weren't enabled (try: `--prerelease=allow`)

hint: Metadata for `anyio` (v4.3.0) could not be fetched; the server returned: `401 Unauthorized`
help: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooooh, this is terrific. That error message by itself is quite a potent troubleshooting aide.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S. if this test case were cloned with --prerelease=allow, it should succeed, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality resolver Related to the package resolver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv pip resolver should be able to backtrack on 403
4 participants