From 29a81d454f8ba1b84d99d94a92c54276af1ce497 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Wed, 18 Jun 2025 14:53:59 -0700 Subject: [PATCH 1/2] envsExtExperiment --- package.json | 12 ++++++++---- package.nls.json | 1 + src/client/common/experiments/groups.ts | 4 ++++ src/client/common/experiments/helpers.ts | 7 ++++++- src/client/envExt/api.internal.ts | 4 +++- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 0414e9df1b04..bd99da6f00a5 100644 --- a/package.json +++ b/package.json @@ -456,7 +456,8 @@ "pythonPromptNewToolsExt", "pythonTerminalEnvVarActivation", "pythonDiscoveryUsingWorkers", - "pythonTestAdapter" + "pythonTestAdapter", + "pythonEnvExtEnabled" ], "enumDescriptions": [ "%python.experiments.All.description%", @@ -464,7 +465,8 @@ "%python.experiments.pythonPromptNewToolsExt.description%", "%python.experiments.pythonTerminalEnvVarActivation.description%", "%python.experiments.pythonDiscoveryUsingWorkers.description%", - "%python.experiments.pythonTestAdapter.description%" + "%python.experiments.pythonTestAdapter.description%", + "%python.experiments.pythonEnvExtEnabled.description%" ] }, "scope": "window", @@ -481,7 +483,8 @@ "pythonPromptNewToolsExt", "pythonTerminalEnvVarActivation", "pythonDiscoveryUsingWorkers", - "pythonTestAdapter" + "pythonTestAdapter", + "pythonEnvExtEnabled" ], "enumDescriptions": [ "%python.experiments.All.description%", @@ -489,7 +492,8 @@ "%python.experiments.pythonPromptNewToolsExt.description%", "%python.experiments.pythonTerminalEnvVarActivation.description%", "%python.experiments.pythonDiscoveryUsingWorkers.description%", - "%python.experiments.pythonTestAdapter.description%" + "%python.experiments.pythonTestAdapter.description%", + "%python.experiments.pythonEnvExtEnabled.description%" ] }, "scope": "window", diff --git a/package.nls.json b/package.nls.json index b6ba75b332f2..eccf6a24d59a 100644 --- a/package.nls.json +++ b/package.nls.json @@ -45,6 +45,7 @@ "python.experiments.pythonSurveyNotification.description": "Denotes the Python Survey Notification experiment.", "python.experiments.pythonPromptNewToolsExt.description": "Denotes the Python Prompt New Tools Extension experiment.", "python.experiments.pythonTerminalEnvVarActivation.description": "Enables use of environment variables to activate terminals instead of sending activation commands.", + "python.experiments.pythonEnvExtEnabled.description": "Enables the Python Environment Extension to be enabled by default.", "python.experiments.pythonDiscoveryUsingWorkers.description": "Enables use of worker threads to do heavy computation when discovering interpreters.", "python.experiments.pythonTestAdapter.description": "Denotes the Python Test Adapter experiment.", "python.experiments.pythonRecommendTensorboardExt.description": "Denotes the Tensorboard Extension recommendation experiment.", diff --git a/src/client/common/experiments/groups.ts b/src/client/common/experiments/groups.ts index 12f4ef89018b..decc3aa2f481 100644 --- a/src/client/common/experiments/groups.ts +++ b/src/client/common/experiments/groups.ts @@ -11,6 +11,10 @@ export enum TerminalEnvVarActivation { experiment = 'pythonTerminalEnvVarActivation', } +export enum EnvExtEnabled { + experiment = 'pythonEnvExtEnabled', +} + export enum DiscoveryUsingWorkers { experiment = 'pythonDiscoveryUsingWorkers', } diff --git a/src/client/common/experiments/helpers.ts b/src/client/common/experiments/helpers.ts index f6ae39d260f5..973e271fb9bc 100644 --- a/src/client/common/experiments/helpers.ts +++ b/src/client/common/experiments/helpers.ts @@ -5,9 +5,10 @@ import { env, workspace } from 'vscode'; import { IExperimentService } from '../types'; -import { TerminalEnvVarActivation } from './groups'; +import { EnvExtEnabled, TerminalEnvVarActivation } from './groups'; import { isTestExecution } from '../constants'; import { traceInfo } from '../../logging'; +import { inExperiment } from '../../pythonEnvironments/common/externalDependencies'; export function inTerminalEnvVarExperiment(experimentService: IExperimentService): boolean { if (!isTestExecution() && env.remoteName && workspace.workspaceFolders && workspace.workspaceFolders.length > 1) { @@ -20,3 +21,7 @@ export function inTerminalEnvVarExperiment(experimentService: IExperimentService } return true; } + +export function inEnvExtEnabledExperiment(): boolean { + return inExperiment(EnvExtEnabled.experiment); +} diff --git a/src/client/envExt/api.internal.ts b/src/client/envExt/api.internal.ts index 552e31a0598e..71c480200c2d 100644 --- a/src/client/envExt/api.internal.ts +++ b/src/client/envExt/api.internal.ts @@ -14,6 +14,7 @@ import { } from './types'; import { executeCommand } from '../common/vscodeApis/commandApis'; import { IInterpreterPathService } from '../common/types'; +import { inEnvExtEnabledExperiment } from '../common/experiments/helpers'; export const ENVS_EXTENSION_ID = 'ms-python.vscode-python-envs'; @@ -22,7 +23,8 @@ export function useEnvExtension(): boolean { if (_useExt !== undefined) { return _useExt; } - _useExt = !!getExtension(ENVS_EXTENSION_ID); + // If extension is installed and in experiment, then use it. + _useExt = !!getExtension(ENVS_EXTENSION_ID) && inEnvExtEnabledExperiment(); return _useExt; } From 61b4446e74e5fd24e17d4b702bd8eaee379ea084 Mon Sep 17 00:00:00 2001 From: Eleanor Boyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Thu, 19 Jun 2025 09:36:17 -0700 Subject: [PATCH 2/2] Update package.nls.json Co-authored-by: Courtney Webster <60238438+cwebster-99@users.noreply.github.com> --- package.nls.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.nls.json b/package.nls.json index eccf6a24d59a..a6ac7dfdcf60 100644 --- a/package.nls.json +++ b/package.nls.json @@ -45,7 +45,7 @@ "python.experiments.pythonSurveyNotification.description": "Denotes the Python Survey Notification experiment.", "python.experiments.pythonPromptNewToolsExt.description": "Denotes the Python Prompt New Tools Extension experiment.", "python.experiments.pythonTerminalEnvVarActivation.description": "Enables use of environment variables to activate terminals instead of sending activation commands.", - "python.experiments.pythonEnvExtEnabled.description": "Enables the Python Environment Extension to be enabled by default.", + "python.experiments.pythonEnvExtEnabled.description": "Enables the Python Environments extension to be enabled by default.", "python.experiments.pythonDiscoveryUsingWorkers.description": "Enables use of worker threads to do heavy computation when discovering interpreters.", "python.experiments.pythonTestAdapter.description": "Denotes the Python Test Adapter experiment.", "python.experiments.pythonRecommendTensorboardExt.description": "Denotes the Tensorboard Extension recommendation experiment.",