File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
crates/uv/src/commands/project Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -401,10 +401,29 @@ pub(crate) async fn get_or_init_environment(
401
401
venv. user_display( ) . cyan( )
402
402
) ?;
403
403
404
+ // Determine a prompt for the environment, in order of preference:
405
+ //
406
+ // 1) The name of the project
407
+ // 2) The name of the directory at the root of the workspace
408
+ // 3) No prompt
409
+ let prompt = workspace
410
+ . pyproject_toml ( )
411
+ . project
412
+ . as_ref ( )
413
+ . map ( |p| p. name . to_string ( ) )
414
+ . or_else ( || {
415
+ workspace
416
+ . install_path ( )
417
+ . file_name ( )
418
+ . map ( |f| f. to_string_lossy ( ) . to_string ( ) )
419
+ } )
420
+ . map ( uv_virtualenv:: Prompt :: Static )
421
+ . unwrap_or ( uv_virtualenv:: Prompt :: None ) ;
422
+
404
423
Ok ( uv_virtualenv:: create_venv (
405
424
& venv,
406
425
interpreter,
407
- uv_virtualenv :: Prompt :: None ,
426
+ prompt ,
408
427
false ,
409
428
false ,
410
429
false ,
You can’t perform that action at this time.
0 commit comments