Files
uv/crates/uv-resolver/src/dependency_mode.rs
T
Charlie Marsh 5a23f05799 Store resolution options in lockfile (#5264)
## Summary

This PR modifies the lockfile to include the impactful resolution
settings, like the resolution and pre-release mode. If any of those
values change, we want to ignore the existing lockfile. Otherwise,
`--resolution lowest-direct` will typically have no effect, which is
really unintuitive.

Closes https://github.com/astral-sh/uv/issues/5226.
2024-07-22 08:28:22 -04:00

21 lines
645 B
Rust

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Deserialize)]
pub enum DependencyMode {
/// Include all dependencies, whether direct or transitive.
#[default]
Transitive,
/// Exclude transitive dependencies, only resolving the root package's immediate dependencies.
Direct,
}
impl DependencyMode {
/// Returns `true` if transitive dependencies should be included.
pub fn is_transitive(self) -> bool {
matches!(self, Self::Transitive)
}
/// Returns `true` if (only) direct dependencies should be excluded.
pub fn is_direct(self) -> bool {
matches!(self, Self::Direct)
}
}