mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-18 03:13:48 +00:00
## Summary This PR makes the behavior in https://github.com/astral-sh/uv/pull/9827 the default: we try to select the latest supported package version for each supported Python version, but we still optimize for choosing fewer versions when stratifying by platform. However, you can opt out with `--fork-strategy fewest`. Closes https://github.com/astral-sh/uv/issues/7190.
23 lines
939 B
Rust
23 lines
939 B
Rust
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
|
pub enum ForkStrategy {
|
|
/// Optimize for selecting the fewest number of versions for each package. Older versions may
|
|
/// be preferred if they are compatible with a wider range of supported Python versions or
|
|
/// platforms.
|
|
Fewest,
|
|
/// Optimize for selecting latest supported version of each package, for each supported Python
|
|
/// version.
|
|
#[default]
|
|
RequiresPython,
|
|
}
|
|
|
|
impl std::fmt::Display for ForkStrategy {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
Self::Fewest => write!(f, "fewest"),
|
|
Self::RequiresPython => write!(f, "requires-python"),
|
|
}
|
|
}
|
|
}
|