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

Improve resolver error messages when --offline is used #6156

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/uv-resolver/src/pubgrub/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ impl std::fmt::Display for PubGrubHint {
Self::Offline => {
write!(
f,
"{}{} Packages were unavailable because the network was disabled",
"{}{} Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.",
"hint".bold().cyan(),
":".bold(),
)
Expand Down
4 changes: 1 addition & 3 deletions crates/uv-resolver/src/resolver/availability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ impl Display for UnavailableVersion {
UnavailableVersion::InvalidMetadata => f.write_str("has invalid metadata"),
UnavailableVersion::InconsistentMetadata => f.write_str("has inconsistent metadata"),
UnavailableVersion::InvalidStructure => f.write_str("has an invalid package format"),
UnavailableVersion::Offline => f.write_str(
"network connectivity is disabled, but the metadata wasn't found in the cache",
),
UnavailableVersion::Offline => f.write_str("needs to be downloaded from a registry"),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/uv/tests/cache_prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ fn prune_unzipped() -> Result<()> {
iniconfig==1.1.0
iniconfig==1.1.1
iniconfig==2.0.0
network connectivity is disabled, but the metadata wasn't found in the cache, we can conclude that iniconfig<1.0.0 cannot be used.
needs to be downloaded from a registry, we can conclude that iniconfig<1.0.0 cannot be used.
And because you require iniconfig, we can conclude that your requirements are unsatisfiable.

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

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8602,7 +8602,7 @@ fn lock_add_member() -> Result<()> {
╰─▶ Because anyio was not found in the cache and leaf depends on anyio>3, we can conclude that leaf's requirements are unsatisfiable.
And because your workspace requires leaf, we can conclude that your workspace's requirements are unsatisfiable.

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###);

// Re-run without `--locked`.
Expand Down
6 changes: 3 additions & 3 deletions crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5513,7 +5513,7 @@ fn offline_registry() -> Result<()> {
× No solution found when resolving dependencies:
╰─▶ Because black was not found in the cache and you require black==23.10.1, we can conclude that your requirements are unsatisfiable.

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###
);

Expand Down Expand Up @@ -5644,7 +5644,7 @@ fn offline_find_links() -> Result<()> {
× No solution found when resolving dependencies:
╰─▶ Because tqdm was not found in the cache and you require tqdm, we can conclude that your requirements are unsatisfiable.

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###
);

Expand All @@ -5663,7 +5663,7 @@ fn offline_find_links() -> Result<()> {
× No solution found when resolving dependencies:
╰─▶ Because tqdm was not found in the cache and you require tqdm, we can conclude that your requirements are unsatisfiable.

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###
);

Expand Down
4 changes: 2 additions & 2 deletions crates/uv/tests/pip_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2789,7 +2789,7 @@ fn find_links_offline_no_match() -> Result<()> {
× No solution found when resolving dependencies:
╰─▶ Because numpy was not found in the cache and you require numpy, we can conclude that your requirements are unsatisfiable.

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###
);

Expand Down Expand Up @@ -2916,7 +2916,7 @@ fn offline() -> Result<()> {
× No solution found when resolving dependencies:
╰─▶ Because black was not found in the cache and you require black==23.10.1, we can conclude that your requirements are unsatisfiable.

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###
);

Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ fn workspace_inherit_sources() -> Result<()> {
╰─▶ Because library was not found in the cache and leaf depends on library, we can conclude that leaf's requirements are unsatisfiable.
And because your workspace requires leaf, we can conclude that your workspace's requirements are unsatisfiable.

hint: Packages were unavailable because the network was disabled
hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.
"###
);

Expand Down
Loading