@@ -166,12 +166,14 @@ pub(crate) async fn install(
166166) -> Result < ExitStatus > {
167167 let start = std:: time:: Instant :: now ( ) ;
168168
169+ // TODO(zanieb): We should consider marking the Python installation as the default when
170+ // `--default` is used. It's not clear how this overlaps with a global Python pin, but I'd be
171+ // surprised if `uv python find` returned the "newest" Python version rather than the one I just
172+ // installed with the `--default` flag.
169173 if default && !preview. is_enabled ( ) {
170- writeln ! (
171- printer. stderr( ) ,
172- "The `--default` flag is only available in preview mode; add the `--preview` flag to use `--default`"
173- ) ?;
174- return Ok ( ExitStatus :: Failure ) ;
174+ warn_user ! (
175+ "The `--default` option is experimental and may change without warning. Pass `--preview` to disable this warning"
176+ ) ;
175177 }
176178
177179 if upgrade && preview. is_disabled ( ) {
@@ -222,6 +224,8 @@ pub(crate) async fn install(
222224 . map ( PythonVersionFile :: into_versions)
223225 . unwrap_or_else ( || {
224226 // If no version file is found and no requests were made
227+ // TODO(zanieb): We should consider differentiating between a global Python version
228+ // file here, allowing a request from there to enable `is_default_install`.
225229 is_default_install = true ;
226230 vec ! [ if reinstall {
227231 // On bare `--reinstall`, reinstall all Python versions
@@ -451,10 +455,10 @@ pub(crate) async fn install(
451455 }
452456 }
453457
454- let bin_dir = if matches ! ( bin, Some ( true ) ) || preview. is_enabled ( ) {
455- Some ( python_executable_dir ( ) ?)
456- } else {
458+ let bin_dir = if matches ! ( bin, Some ( false ) ) {
457459 None
460+ } else {
461+ Some ( python_executable_dir ( ) ?)
458462 } ;
459463
460464 let installations: Vec < _ > = downloaded. iter ( ) . chain ( satisfied. iter ( ) . copied ( ) ) . collect ( ) ;
@@ -469,20 +473,10 @@ pub(crate) async fn install(
469473 e. warn_user ( installation) ;
470474 }
471475
472- if preview. is_disabled ( ) {
473- debug ! ( "Skipping installation of Python executables, use `--preview` to enable." ) ;
474- continue ;
475- }
476-
477- let bin_dir = bin_dir
478- . as_ref ( )
479- . expect ( "We should have a bin directory with preview enabled" )
480- . as_path ( ) ;
481-
482476 let upgradeable = ( default || is_default_install)
483477 || requested_minor_versions. contains ( & installation. key ( ) . version ( ) . python_version ( ) ) ;
484478
485- if ! matches ! ( bin , Some ( false ) ) {
479+ if let Some ( bin_dir ) = bin_dir . as_ref ( ) {
486480 create_bin_links (
487481 installation,
488482 bin_dir,
@@ -661,11 +655,7 @@ pub(crate) async fn install(
661655 }
662656 }
663657
664- if preview. is_enabled ( ) && !matches ! ( bin, Some ( false ) ) {
665- let bin_dir = bin_dir
666- . as_ref ( )
667- . expect ( "We should have a bin directory with preview enabled" )
668- . as_path ( ) ;
658+ if let Some ( bin_dir) = bin_dir. as_ref ( ) {
669659 warn_if_not_on_path ( bin_dir) ;
670660 }
671661 }
@@ -749,16 +739,20 @@ fn create_bin_links(
749739 errors : & mut Vec < ( InstallErrorKind , PythonInstallationKey , Error ) > ,
750740 preview : PreviewMode ,
751741) {
752- let targets =
753- if ( default || is_default_install) && first_request. matches_installation ( installation) {
754- vec ! [
755- installation. key( ) . executable_name_minor( ) ,
756- installation. key( ) . executable_name_major( ) ,
757- installation. key( ) . executable_name( ) ,
758- ]
759- } else {
760- vec ! [ installation. key( ) . executable_name_minor( ) ]
761- } ;
742+ // TODO(zanieb): We want more feedback on the `is_default_install` behavior before stabilizing
743+ // it. In particular, it may be confusing because it does not apply when versions are loaded
744+ // from a `.python-version` file.
745+ let targets = if ( default || ( is_default_install && preview. is_enabled ( ) ) )
746+ && first_request. matches_installation ( installation)
747+ {
748+ vec ! [
749+ installation. key( ) . executable_name_minor( ) ,
750+ installation. key( ) . executable_name_major( ) ,
751+ installation. key( ) . executable_name( ) ,
752+ ]
753+ } else {
754+ vec ! [ installation. key( ) . executable_name_minor( ) ]
755+ } ;
762756
763757 for target in targets {
764758 let target = bin. join ( target) ;
0 commit comments