Skip to content

Commit

Permalink
uv-resolver: add some tracing logs for when we filter requirements
Browse files Browse the repository at this point in the history
Specifically, these are emitted when requirements fail to satisfy
`Requires-Python` or the markers associated with the current fork in the
resolver.

Closes #4373
  • Loading branch information
BurntSushi committed Jun 18, 2024
1 parent 58f53f0 commit 20b44f3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion crates/uv-resolver/src/pubgrub/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use either::Either;
use itertools::Itertools;
use pubgrub::range::Range;
use rustc_hash::FxHashSet;
use tracing::warn;
use tracing::{trace, warn};

use distribution_types::Verbatim;
use pep440_rs::Version;
Expand Down Expand Up @@ -106,13 +106,20 @@ fn add_requirements(
// If the requirement would not be selected with any Python version
// supported by the root, skip it.
if !satisfies_requires_python(requires_python, requirement) {
trace!(
"skipping {requirement} because of Requires-Python {requires_python}",
// OK because this filter only applies when there is a present
// Requires-Python specifier.
requires_python = requires_python.unwrap()
);
continue;
}
// If we're in universal mode, `fork_markers` might correspond to a
// non-trivial marker expression that provoked the resolver to fork.
// In that case, we should ignore any dependency that cannot possibly
// satisfy the markers that provoked the fork.
if !possible_to_satisfy_markers(fork_markers, requirement) {
trace!("skipping {requirement} because of context resolver markers {fork_markers}");
continue;
}
// If the requirement isn't relevant for the current platform, skip it.
Expand Down Expand Up @@ -194,6 +201,12 @@ fn add_requirements(
// If the requirement would not be selected with any Python
// version supported by the root, skip it.
if !satisfies_requires_python(requires_python, constraint) {
trace!(
"skipping {requirement} because of Requires-Python {requires_python}",
// OK because this filter only applies when there is a present
// Requires-Python specifier.
requires_python = requires_python.unwrap()
);
continue;
}
// If we're in universal mode, `fork_markers` might correspond
Expand All @@ -202,6 +215,9 @@ fn add_requirements(
// dependency that cannot possibly satisfy the markers that
// provoked the fork.
if !possible_to_satisfy_markers(fork_markers, constraint) {
trace!(
"skipping {requirement} because of context resolver markers {fork_markers}"
);
continue;
}
// If the requirement isn't relevant for the current platform, skip it.
Expand Down

0 comments on commit 20b44f3

Please sign in to comment.