diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index 5ef816950..e3885a9c1 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -111,11 +111,11 @@ async fn run(mut cli: Cli) -> Result { if !skip_project_validation { if let Some(project_path) = cli.top_level.global_args.project.as_ref() { - // Resolve the preview flags until this becomes stabilized. We check CLI args and - // the `UV_PREVIEW` env var, but not workspace config (which requires reading from - // the project directory that may not exist). + // Resolve the preview flags until this becomes stabilized. We do + // not pass a workspace configuration as this would require reading + // from the project directory which might not exist. let preview = Preview::from_args( - cli.top_level.global_args.preview || environment.preview.value == Some(true), + settings::resolve_preview(&cli.top_level.global_args, None, &environment), cli.top_level.global_args.no_preview, &cli.top_level.global_args.preview_features, ); diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 7c0c2b851..bfe980ba8 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -213,7 +213,7 @@ fn resolve_python_preference( } /// Resolve the preview setting from CLI, environment, and workspace config. -fn resolve_preview( +pub(crate) fn resolve_preview( args: &GlobalArgs, workspace: Option<&FilesystemOptions>, environment: &EnvironmentOptions,