@@ -12,6 +12,7 @@ import { createDeferred } from './common/utils/deferred';
1212import {
1313 activeTerminal ,
1414 createLogOutputChannel ,
15+ createTerminal ,
1516 onDidChangeActiveTerminal ,
1617 onDidChangeTerminalShellIntegration ,
1718} from './common/window.apis' ;
@@ -66,7 +67,7 @@ import { ProjectItem } from './features/views/treeViewItems';
6667import { EnvironmentManagers , ProjectCreators , PythonProjectManager } from './internal.api' ;
6768import { registerSystemPythonFeatures } from './managers/builtin/main' ;
6869import { SysPythonManager } from './managers/builtin/sysPythonManager' ;
69- import { createNativePythonFinder , NativePythonFinder } from './managers/common/nativePythonFinder' ;
70+ import { createNativePythonFinder , getNativePythonToolsPath , NativePythonFinder } from './managers/common/nativePythonFinder' ;
7071import { IDisposable } from './managers/common/types' ;
7172import { registerCondaFeatures } from './managers/conda/main' ;
7273import { registerPoetryFeatures } from './managers/poetry/main' ;
@@ -429,6 +430,21 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
429430 window . showErrorMessage ( `Failed to open issue reporter: ${ error } ` ) ;
430431 }
431432 } ) ,
433+ commands . registerCommand ( 'python-envs.runPetInTerminal' , async ( ) => {
434+ try {
435+ const petPath = await getNativePythonToolsPath ( ) ;
436+ const terminal = createTerminal ( {
437+ name : 'Python Environment Tool (PET)' ,
438+ shellPath : petPath ,
439+ shellArgs : [ ]
440+ } ) ;
441+ terminal . show ( ) ;
442+ traceInfo ( `Created terminal with PET: ${ petPath } ` ) ;
443+ } catch ( error ) {
444+ traceError ( 'Error running PET in terminal' , error ) ;
445+ window . showErrorMessage ( `Failed to run Python Environment Tool: ${ error } ` ) ;
446+ }
447+ } ) ,
432448 terminalActivation . onDidChangeTerminalActivationState ( async ( e ) => {
433449 await setActivateMenuButtonContext ( e . terminal , e . environment , e . activated ) ;
434450 } ) ,
0 commit comments