@@ -4,7 +4,7 @@ import * as path from 'path';
44import { l10n , LogOutputChannel , ProgressLocation , QuickPickItem , QuickPickItemKind , ThemeIcon , Uri } from 'vscode' ;
55import { EnvironmentManager , PythonEnvironment , PythonEnvironmentApi , PythonEnvironmentInfo } from '../../api' ;
66import { ENVS_EXTENSION_ID } from '../../common/constants' ;
7- import { Common , VenvManagerStrings } from '../../common/localize' ;
7+ import { Common , VenvManagerStringsNoUv } from '../../common/localize' ;
88import { traceInfo } from '../../common/logging' ;
99import { getWorkspacePersistentState } from '../../common/persistentState' ;
1010import { pickEnvironmentFrom } from '../../common/pickers/environments' ;
@@ -209,15 +209,15 @@ export async function getGlobalVenvLocation(): Promise<Uri | undefined> {
209209 const items : FolderQuickPickItem [ ] = [
210210 {
211211 label : Common . browse ,
212- description : VenvManagerStrings . venvGlobalFolder ,
212+ description : VenvManagerStringsNoUv . venvGlobalFolder ,
213213 } ,
214214 ] ;
215215
216216 const venvPaths = getVenvFoldersSetting ( ) ;
217217 if ( venvPaths . length > 0 ) {
218218 items . push (
219219 {
220- label : VenvManagerStrings . venvGlobalFoldersSetting ,
220+ label : VenvManagerStringsNoUv . venvGlobalFoldersSetting ,
221221 kind : QuickPickItemKind . Separator ,
222222 } ,
223223 ...venvPaths . map ( ( p ) => ( {
@@ -243,7 +243,7 @@ export async function getGlobalVenvLocation(): Promise<Uri | undefined> {
243243 }
244244
245245 const selected = await showQuickPick ( items , {
246- placeHolder : VenvManagerStrings . venvGlobalFolder ,
246+ placeHolder : VenvManagerStringsNoUv . venvGlobalFolder ,
247247 ignoreFocusOut : true ,
248248 } ) ;
249249
@@ -269,24 +269,24 @@ async function createWithCustomization(version: string): Promise<boolean | undef
269269 const selection : QuickPickItem | undefined = await showQuickPick (
270270 [
271271 {
272- label : VenvManagerStrings . quickCreate ,
273- description : VenvManagerStrings . quickCreateDescription ,
272+ label : VenvManagerStringsNoUv . quickCreate ,
273+ description : VenvManagerStringsNoUv . quickCreateDescription ,
274274 detail : l10n . t ( 'Uses Python version {0} and installs workspace dependencies.' , version ) ,
275275 } ,
276276 {
277- label : VenvManagerStrings . customize ,
278- description : VenvManagerStrings . customizeDescription ,
277+ label : VenvManagerStringsNoUv . customize ,
278+ description : VenvManagerStringsNoUv . customizeDescription ,
279279 } ,
280280 ] ,
281281 {
282- placeHolder : VenvManagerStrings . selectQuickOrCustomize ,
282+ placeHolder : VenvManagerStringsNoUv . selectQuickOrCustomize ,
283283 ignoreFocusOut : true ,
284284 } ,
285285 ) ;
286286
287287 if ( selection === undefined ) {
288288 return undefined ;
289- } else if ( selection . label === VenvManagerStrings . quickCreate ) {
289+ } else if ( selection . label === VenvManagerStringsNoUv . quickCreate ) {
290290 return false ;
291291 }
292292 return true ;
@@ -305,19 +305,27 @@ async function createWithProgress(
305305 const pythonPath =
306306 os . platform ( ) === 'win32' ? path . join ( envPath , 'Scripts' , 'python.exe' ) : path . join ( envPath , 'bin' , 'python' ) ;
307307
308+ const useUv = await isUvInstalled ( log ) ;
309+ const progressTitle = useUv
310+ ? l10n . t (
311+ 'Creating virtual environment named {0} using python version {1} [uv].' ,
312+ path . basename ( envPath ) ,
313+ basePython . version ,
314+ )
315+ : l10n . t (
316+ 'Creating virtual environment named {0} using python version {1}.' ,
317+ path . basename ( envPath ) ,
318+ basePython . version ,
319+ ) ;
320+
308321 return await withProgress (
309322 {
310323 location : ProgressLocation . Notification ,
311- title : l10n . t (
312- 'Creating virtual environment named {0} using python version {1}.' ,
313- path . basename ( envPath ) ,
314- basePython . version ,
315- ) ,
324+ title : progressTitle ,
316325 } ,
317326 async ( ) => {
318327 const result : CreateEnvironmentResult = { } ;
319328 try {
320- const useUv = await isUvInstalled ( log ) ;
321329 // env creation
322330 if ( basePython . execInfo ?. run . executable ) {
323331 if ( useUv ) {
@@ -353,13 +361,19 @@ async function createWithProgress(
353361 } ) ;
354362 } catch ( e ) {
355363 // error occurred while installing packages
356- result . pkgInstallationErr = e instanceof Error ? e . message : String ( e ) ;
364+ result . pkgInstallationErr = useUv
365+ ? `Failed to install packages with uv: ${ e instanceof Error ? e . message : String ( e ) } `
366+ : e instanceof Error
367+ ? e . message
368+ : String ( e ) ;
357369 }
358370 }
359371 result . environment = env ;
360372 } catch ( e ) {
361- log . error ( `Failed to create virtual environment: ${ e } ` ) ;
362- result . envCreationErr = `Failed to create virtual environment: ${ e } ` ;
373+ result . envCreationErr = useUv
374+ ? `Failed to create virtual environment with uv: ${ e } `
375+ : `Failed to create virtual environment: ${ e } ` ;
376+ log . error ( result . envCreationErr ) ;
363377 }
364378 return result ;
365379 } ,
@@ -369,14 +383,14 @@ async function createWithProgress(
369383export function ensureGlobalEnv ( basePythons : PythonEnvironment [ ] , log : LogOutputChannel ) : PythonEnvironment [ ] {
370384 if ( basePythons . length === 0 ) {
371385 log . error ( 'No base python found' ) ;
372- showErrorMessage ( VenvManagerStrings . venvErrorNoBasePython ) ;
386+ showErrorMessage ( VenvManagerStringsNoUv . venvErrorNoBasePython ) ;
373387 throw new Error ( 'No base python found' ) ;
374388 }
375389
376390 const filtered = basePythons . filter ( ( e ) => e . version . startsWith ( '3.' ) ) ;
377391 if ( filtered . length === 0 ) {
378392 log . error ( 'Did not find any base python 3.*' ) ;
379- showErrorMessage ( VenvManagerStrings . venvErrorNoPython3 ) ;
393+ showErrorMessage ( VenvManagerStringsNoUv . venvErrorNoPython3 ) ;
380394 basePythons . forEach ( ( e , i ) => {
381395 log . error ( `${ i } : ${ e . version } : ${ e . environmentPath . fsPath } ` ) ;
382396 } ) ;
@@ -457,15 +471,15 @@ export async function createPythonVenv(
457471 }
458472
459473 const name = await showInputBox ( {
460- prompt : VenvManagerStrings . venvName ,
474+ prompt : VenvManagerStringsNoUv . venvName ,
461475 value : '.venv' ,
462476 ignoreFocusOut : true ,
463477 validateInput : async ( value ) => {
464478 if ( ! value ) {
465- return VenvManagerStrings . venvNameErrorEmpty ;
479+ return VenvManagerStringsNoUv . venvNameErrorEmpty ;
466480 }
467481 if ( await fsapi . pathExists ( path . join ( venvRoot . fsPath , value ) ) ) {
468- return VenvManagerStrings . venvNameErrorExists ;
482+ return VenvManagerStringsNoUv . venvNameErrorExists ;
469483 }
470484 } ,
471485 } ) ;
@@ -513,15 +527,15 @@ export async function removeVenv(environment: PythonEnvironment, log: LogOutputC
513527 const result = await withProgress (
514528 {
515529 location : ProgressLocation . Notification ,
516- title : VenvManagerStrings . venvRemoving ,
530+ title : VenvManagerStringsNoUv . venvRemoving ,
517531 } ,
518532 async ( ) => {
519533 try {
520534 await fsapi . remove ( envPath ) ;
521535 return true ;
522536 } catch ( e ) {
523537 log . error ( `Failed to remove virtual environment: ${ e } ` ) ;
524- showErrorMessage ( VenvManagerStrings . venvRemoveFailed ) ;
538+ showErrorMessage ( VenvManagerStringsNoUv . venvRemoveFailed ) ;
525539 return false ;
526540 }
527541 } ,
0 commit comments