From 6969c4564997c6e082b9cd5846114ea10531037a Mon Sep 17 00:00:00 2001 From: Jonathan Rayner Date: Wed, 10 May 2023 16:49:28 +0100 Subject: [PATCH 1/3] Feat: Add pyenv interpreters when creating environments with venv, resolves #20881 --- .../pythonEnvironments/creation/provider/venvCreationProvider.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts index e18f2fa79fde..f693a191d51b 100644 --- a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts +++ b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts @@ -162,6 +162,7 @@ export class VenvCreationProvider implements CreateEnvironmentProvider { EnvironmentType.System, EnvironmentType.MicrosoftStore, EnvironmentType.Global, + EnvironmentType.Pyenv, ].includes(i.envType), { skipRecommended: true, From 4196e111dd4380c0d951fc0655efda7998e46860 Mon Sep 17 00:00:00 2001 From: Jonathan Rayner Date: Fri, 12 May 2023 13:33:35 +0100 Subject: [PATCH 2/3] fix: only use global interpreters for venv environment creation --- .../creation/provider/venvCreationProvider.ts | 2 +- src/client/pythonEnvironments/info/index.ts | 4 +++- src/client/pythonEnvironments/legacyIOC.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts index f693a191d51b..f934a38e3192 100644 --- a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts +++ b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts @@ -163,7 +163,7 @@ export class VenvCreationProvider implements CreateEnvironmentProvider { EnvironmentType.MicrosoftStore, EnvironmentType.Global, EnvironmentType.Pyenv, - ].includes(i.envType), + ].includes(i.envType) && i.type === undefined, // only global intepreters { skipRecommended: true, showBackButton: true, diff --git a/src/client/pythonEnvironments/info/index.ts b/src/client/pythonEnvironments/info/index.ts index 70abbb0fad76..60628f61314e 100644 --- a/src/client/pythonEnvironments/info/index.ts +++ b/src/client/pythonEnvironments/info/index.ts @@ -68,10 +68,11 @@ export type InterpreterInformation = { * * @prop companyDisplayName - the user-facing name of the distro publisher * @prop displayName - the user-facing name for the environment - * @prop type - the kind of Python environment + * @prop envType - the kind of Python environment * @prop envName - the environment's name, if applicable (else `envPath` is set) * @prop envPath - the environment's root dir, if applicable (else `envName`) * @prop cachedEntry - whether or not the info came from a cache + * @prop type - the type of Python environment, if applicable */ // Note that "cachedEntry" is specific to the caching machinery // and doesn't really belong here. @@ -84,6 +85,7 @@ export type PythonEnvironment = InterpreterInformation & { envName?: string; envPath?: string; cachedEntry?: boolean; + type?: string; }; /** diff --git a/src/client/pythonEnvironments/legacyIOC.ts b/src/client/pythonEnvironments/legacyIOC.ts index 0c80c3414728..f116bdb63a89 100644 --- a/src/client/pythonEnvironments/legacyIOC.ts +++ b/src/client/pythonEnvironments/legacyIOC.ts @@ -75,6 +75,7 @@ function convertEnvInfo(info: PythonEnvInfo): PythonEnvironment { } env.displayName = info.display; env.detailedDisplayName = info.detailedDisplayName; + env.type = info.type; // We do not worry about using distro.defaultDisplayName. return env; From c2ec7e89f723cc5fc86f7a8fceac4a019bd66808 Mon Sep 17 00:00:00 2001 From: Jonathan Rayner Date: Fri, 12 May 2023 19:22:17 +0100 Subject: [PATCH 3/3] fix: format code with prettier --- .../creation/provider/venvCreationProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts index f934a38e3192..b00682c3cb5d 100644 --- a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts +++ b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts @@ -163,7 +163,7 @@ export class VenvCreationProvider implements CreateEnvironmentProvider { EnvironmentType.MicrosoftStore, EnvironmentType.Global, EnvironmentType.Pyenv, - ].includes(i.envType) && i.type === undefined, // only global intepreters + ].includes(i.envType) && i.type === undefined, // only global intepreters { skipRecommended: true, showBackButton: true,