Skip to content

Commit

Permalink
Avoid 403 error hint for PyTorch URLs (#9750)
Browse files Browse the repository at this point in the history
## Summary

Closes #9746.
  • Loading branch information
charliermarsh authored Dec 9, 2024
1 parent 3992295 commit 25045cb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions crates/uv-resolver/src/pubgrub/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,12 @@ impl PubGrubReportFormatter<'_> {
});
}
if index_capabilities.forbidden(&index.url) {
// If the index is a PyTorch index (e.g., `https://download.pytorch.org/whl/cu118`),
// avoid noting the lack of credentials. PyTorch returns a 403 (Forbidden) status
// code for any package that does not exist.
if index.url.url().host_str() == Some("download.pytorch.org") {
continue;
}
hints.insert(PubGrubHint::ForbiddenIndex {
index: index.url.clone(),
});
Expand Down
2 changes: 0 additions & 2 deletions crates/uv/tests/it/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14017,8 +14017,6 @@ fn lock_default_index() -> Result<()> {
----- stderr -----
× No solution found when resolving dependencies:
╰─▶ Because iniconfig was not found in the package registry and your project depends on iniconfig, we can conclude that your project's requirements are unsatisfiable.

hint: An index URL (https://download.pytorch.org/whl/cu121) could not be queried due to a lack of valid authentication credentials (403 Forbidden).
"###);

let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap();
Expand Down
2 changes: 0 additions & 2 deletions crates/uv/tests/it/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6703,8 +6703,6 @@ fn index_url_in_requirements() -> Result<()> {
----- stderr -----
× No solution found when resolving dependencies:
╰─▶ Because anyio was not found in the package registry and you require anyio<4, we can conclude that your requirements are unsatisfiable.
hint: An index URL (https://download.pytorch.org/whl) could not be queried due to a lack of valid authentication credentials (403 Forbidden).
"###
);

Expand Down

0 comments on commit 25045cb

Please sign in to comment.