Skip to main content

uv_configuration/
python_upgrade.rs

1/// The command that requested a managed Python upgrade.
2#[derive(Debug, Clone, Copy)]
3pub enum PythonUpgradeSource {
4    /// The user invoked `uv python install --upgrade`
5    Install,
6    /// The user invoked `uv python upgrade`
7    Upgrade,
8}
9
10impl std::fmt::Display for PythonUpgradeSource {
11    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12        match self {
13            Self::Install => write!(f, "uv python install --upgrade"),
14            Self::Upgrade => write!(f, "uv python upgrade"),
15        }
16    }
17}
18
19/// Whether managed Python installations should be upgraded.
20#[derive(Debug, Clone, Copy)]
21pub enum PythonUpgrade {
22    /// Python upgrades are enabled.
23    Enabled(PythonUpgradeSource),
24    /// Python upgrades are disabled.
25    Disabled,
26}