mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-27 18:36:44 +00:00
Split preview mode into separate feature flags (#14823)
I think this would give us better hygiene than a global flag. It makes it easier for users to opt-in to overlapping features, such as Python upgrades and Python bin installations and to disable warnings for preview mode without opting in to a bunch of other features. In general, I want to reduce the burden for putting something under preview. The `--preview` and `--no-preview` flags are retained as global overrides. A new `--preview-features` option is added which accepts comma separated features or can be passed multiple times, e.g., `--preview-features add-bounds,pylock`. There's a `UV_PREVIEW_FEATURES` environment variable for that option (I'm not sure if we should overload `UV_PREVIEW`, but could be convinced).
This commit is contained in:
parent
9376cf5482
commit
bfb4bc2aeb
55 changed files with 1327 additions and 304 deletions
|
|
@ -8,7 +8,7 @@ use std::{env, io, iter};
|
|||
use std::{path::Path, path::PathBuf, str::FromStr};
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, instrument, trace};
|
||||
use uv_configuration::PreviewMode;
|
||||
use uv_configuration::Preview;
|
||||
use which::{which, which_all};
|
||||
|
||||
use uv_cache::Cache;
|
||||
|
|
@ -335,7 +335,7 @@ fn python_executables_from_installed<'a>(
|
|||
implementation: Option<&'a ImplementationName>,
|
||||
platform: PlatformRequest,
|
||||
preference: PythonPreference,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Box<dyn Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a> {
|
||||
let from_managed_installations = iter::once_with(move || {
|
||||
ManagedPythonInstallations::from_settings(None)
|
||||
|
|
@ -485,7 +485,7 @@ fn python_executables<'a>(
|
|||
platform: PlatformRequest,
|
||||
environments: EnvironmentPreference,
|
||||
preference: PythonPreference,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Box<dyn Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a> {
|
||||
// Always read from `UV_INTERNAL__PARENT_INTERPRETER` — it could be a system interpreter
|
||||
let from_parent_interpreter = iter::once_with(|| {
|
||||
|
|
@ -705,7 +705,7 @@ fn python_interpreters<'a>(
|
|||
environments: EnvironmentPreference,
|
||||
preference: PythonPreference,
|
||||
cache: &'a Cache,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> impl Iterator<Item = Result<(PythonSource, Interpreter), Error>> + 'a {
|
||||
python_interpreters_from_executables(
|
||||
// Perform filtering on the discovered executables based on their source. This avoids
|
||||
|
|
@ -1053,7 +1053,7 @@ pub fn find_python_installations<'a>(
|
|||
environments: EnvironmentPreference,
|
||||
preference: PythonPreference,
|
||||
cache: &'a Cache,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Box<dyn Iterator<Item = Result<FindPythonResult, Error>> + 'a> {
|
||||
let sources = DiscoveryPreferences {
|
||||
python_preference: preference,
|
||||
|
|
@ -1254,7 +1254,7 @@ pub(crate) fn find_python_installation(
|
|||
environments: EnvironmentPreference,
|
||||
preference: PythonPreference,
|
||||
cache: &Cache,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Result<FindPythonResult, Error> {
|
||||
let installations =
|
||||
find_python_installations(request, environments, preference, cache, preview);
|
||||
|
|
@ -1353,7 +1353,7 @@ pub(crate) fn find_best_python_installation(
|
|||
environments: EnvironmentPreference,
|
||||
preference: PythonPreference,
|
||||
cache: &Cache,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Result<FindPythonResult, Error> {
|
||||
debug!("Starting Python discovery for {}", request);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use owo_colors::OwoColorize;
|
|||
use tracing::debug;
|
||||
|
||||
use uv_cache::Cache;
|
||||
use uv_configuration::PreviewMode;
|
||||
use uv_configuration::Preview;
|
||||
use uv_fs::{LockedFile, Simplified};
|
||||
use uv_pep440::Version;
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ impl PythonEnvironment {
|
|||
request: &PythonRequest,
|
||||
preference: EnvironmentPreference,
|
||||
cache: &Cache,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Result<Self, Error> {
|
||||
let installation = match find_python_installation(
|
||||
request,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use tracing::{debug, info};
|
|||
|
||||
use uv_cache::Cache;
|
||||
use uv_client::BaseClientBuilder;
|
||||
use uv_configuration::PreviewMode;
|
||||
use uv_configuration::Preview;
|
||||
use uv_pep440::{Prerelease, Version};
|
||||
|
||||
use crate::discovery::{
|
||||
|
|
@ -58,7 +58,7 @@ impl PythonInstallation {
|
|||
environments: EnvironmentPreference,
|
||||
preference: PythonPreference,
|
||||
cache: &Cache,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Result<Self, Error> {
|
||||
let installation =
|
||||
find_python_installation(request, environments, preference, cache, preview)??;
|
||||
|
|
@ -72,7 +72,7 @@ impl PythonInstallation {
|
|||
environments: EnvironmentPreference,
|
||||
preference: PythonPreference,
|
||||
cache: &Cache,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Result<Self, Error> {
|
||||
Ok(find_best_python_installation(
|
||||
request,
|
||||
|
|
@ -97,7 +97,7 @@ impl PythonInstallation {
|
|||
python_install_mirror: Option<&str>,
|
||||
pypy_install_mirror: Option<&str>,
|
||||
python_downloads_json_url: Option<&str>,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Result<Self, Error> {
|
||||
let request = request.unwrap_or(&PythonRequest::Default);
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ impl PythonInstallation {
|
|||
reporter: Option<&dyn Reporter>,
|
||||
python_install_mirror: Option<&str>,
|
||||
pypy_install_mirror: Option<&str>,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Result<Self, Error> {
|
||||
let installations = ManagedPythonInstallations::from_settings(None)?.init()?;
|
||||
let installations_dir = installations.root();
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ mod tests {
|
|||
use indoc::{formatdoc, indoc};
|
||||
use temp_env::with_vars;
|
||||
use test_log::test;
|
||||
use uv_configuration::PreviewMode;
|
||||
use uv_configuration::Preview;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use uv_cache::Cache;
|
||||
|
|
@ -468,7 +468,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
});
|
||||
assert!(
|
||||
|
|
@ -483,7 +483,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
});
|
||||
assert!(
|
||||
|
|
@ -508,7 +508,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
});
|
||||
assert!(
|
||||
|
|
@ -530,7 +530,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert!(
|
||||
|
|
@ -592,7 +592,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert!(
|
||||
|
|
@ -624,7 +624,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
});
|
||||
assert!(
|
||||
|
|
@ -661,7 +661,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::default(),
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert!(
|
||||
|
|
@ -693,7 +693,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -715,7 +715,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -741,7 +741,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -767,7 +767,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -790,7 +790,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
@ -824,7 +824,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
@ -858,7 +858,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -880,7 +880,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -902,7 +902,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
@ -936,7 +936,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
@ -973,7 +973,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert!(
|
||||
|
|
@ -1004,7 +1004,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert!(
|
||||
|
|
@ -1039,7 +1039,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1065,7 +1065,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1092,7 +1092,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlyVirtual,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1117,7 +1117,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlyVirtual,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
|
@ -1139,7 +1139,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1162,7 +1162,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlyVirtual,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1195,7 +1195,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1216,7 +1216,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1243,7 +1243,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
@ -1261,7 +1261,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
@ -1290,7 +1290,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1328,7 +1328,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1356,7 +1356,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1381,7 +1381,7 @@ mod tests {
|
|||
EnvironmentPreference::ExplicitSystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1406,7 +1406,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1431,7 +1431,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlyVirtual,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1469,7 +1469,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1497,7 +1497,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1514,7 +1514,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1531,7 +1531,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -1553,7 +1553,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlyVirtual,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -1570,7 +1570,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlySystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
|
@ -1592,7 +1592,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1607,7 +1607,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -1621,7 +1621,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -1650,7 +1650,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1666,7 +1666,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1696,7 +1696,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1712,7 +1712,7 @@ mod tests {
|
|||
EnvironmentPreference::ExplicitSystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1728,7 +1728,7 @@ mod tests {
|
|||
EnvironmentPreference::OnlyVirtual,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1744,7 +1744,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1768,7 +1768,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1783,7 +1783,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1807,7 +1807,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1827,7 +1827,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
},
|
||||
)??;
|
||||
|
|
@ -1856,7 +1856,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1878,7 +1878,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -1908,7 +1908,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -1924,7 +1924,7 @@ mod tests {
|
|||
EnvironmentPreference::ExplicitSystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -1951,7 +1951,7 @@ mod tests {
|
|||
EnvironmentPreference::ExplicitSystem,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -1976,7 +1976,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -1993,7 +1993,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2008,7 +2008,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2034,7 +2034,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2049,7 +2049,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2075,7 +2075,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2102,7 +2102,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2129,7 +2129,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2156,7 +2156,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2183,7 +2183,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2211,7 +2211,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})?;
|
||||
assert!(
|
||||
|
|
@ -2233,7 +2233,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2248,7 +2248,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2274,7 +2274,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2289,7 +2289,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
assert_eq!(
|
||||
|
|
@ -2327,7 +2327,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -2345,7 +2345,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -2387,7 +2387,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -2405,7 +2405,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -2442,7 +2442,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -2465,7 +2465,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -2488,7 +2488,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -2527,7 +2527,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
@ -2580,7 +2580,7 @@ mod tests {
|
|||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
PreviewMode::Disabled,
|
||||
Preview::default(),
|
||||
)
|
||||
})??;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use itertools::Itertools;
|
|||
use same_file::is_same_file;
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, warn};
|
||||
use uv_configuration::PreviewMode;
|
||||
use uv_configuration::{Preview, PreviewFeatures};
|
||||
#[cfg(windows)]
|
||||
use windows_sys::Win32::Storage::FileSystem::FILE_ATTRIBUTE_REPARSE_POINT;
|
||||
|
||||
|
|
@ -519,7 +519,7 @@ impl ManagedPythonInstallation {
|
|||
|
||||
/// Ensure the environment contains the symlink directory (or junction on Windows)
|
||||
/// pointing to the patch directory for this minor version.
|
||||
pub fn ensure_minor_version_link(&self, preview: PreviewMode) -> Result<(), Error> {
|
||||
pub fn ensure_minor_version_link(&self, preview: Preview) -> Result<(), Error> {
|
||||
if let Some(minor_version_link) = PythonMinorVersionLink::from_installation(self, preview) {
|
||||
minor_version_link.create_directory()?;
|
||||
}
|
||||
|
|
@ -531,7 +531,7 @@ impl ManagedPythonInstallation {
|
|||
///
|
||||
/// Unlike [`ensure_minor_version_link`], will not create a new symlink directory
|
||||
/// if one doesn't already exist,
|
||||
pub fn update_minor_version_link(&self, preview: PreviewMode) -> Result<(), Error> {
|
||||
pub fn update_minor_version_link(&self, preview: Preview) -> Result<(), Error> {
|
||||
if let Some(minor_version_link) = PythonMinorVersionLink::from_installation(self, preview) {
|
||||
if !minor_version_link.exists() {
|
||||
return Ok(());
|
||||
|
|
@ -702,7 +702,7 @@ impl PythonMinorVersionLink {
|
|||
pub fn from_executable(
|
||||
executable: &Path,
|
||||
key: &PythonInstallationKey,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Option<Self> {
|
||||
let implementation = key.implementation();
|
||||
if !matches!(
|
||||
|
|
@ -755,7 +755,7 @@ impl PythonMinorVersionLink {
|
|||
// If preview mode is disabled, still return a `MinorVersionSymlink` for
|
||||
// existing symlinks, allowing continued operations without the `--preview`
|
||||
// flag after initial symlink directory installation.
|
||||
if preview.is_disabled() && !minor_version_link.exists() {
|
||||
if !preview.is_enabled(PreviewFeatures::PYTHON_UPGRADE) && !minor_version_link.exists() {
|
||||
return None;
|
||||
}
|
||||
Some(minor_version_link)
|
||||
|
|
@ -763,7 +763,7 @@ impl PythonMinorVersionLink {
|
|||
|
||||
pub fn from_installation(
|
||||
installation: &ManagedPythonInstallation,
|
||||
preview: PreviewMode,
|
||||
preview: Preview,
|
||||
) -> Option<Self> {
|
||||
PythonMinorVersionLink::from_executable(
|
||||
installation.executable(false).as_path(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue