From 3b57423d19ef0d4a56aa4a4b34804ffb2d1b19f6 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 10 Apr 2024 07:27:25 +1000 Subject: [PATCH 1/2] Fix activated conda env vars from PythonApi (#15526) --- src/platform/api/types.ts | 4 +-- .../environmentActivationService.node.ts | 27 +++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/platform/api/types.ts b/src/platform/api/types.ts index 8e0fe50e3dd..a53fb64ac6e 100644 --- a/src/platform/api/types.ts +++ b/src/platform/api/types.ts @@ -5,7 +5,7 @@ import { Event, Uri } from 'vscode'; import { Resource } from '../common/types'; import type { SemVer } from 'semver'; import { PythonVersion } from '../pythonEnvironments/info/pythonVersion'; -import { PythonExtension } from '@vscode/python-extension'; +import { PythonExtension, type Environment } from '@vscode/python-extension'; export const IPythonApiProvider = Symbol('IPythonApi'); export interface IPythonApiProvider { @@ -64,7 +64,7 @@ export interface PythonApi { */ getActivatedEnvironmentVariables( resource: Resource, - interpreter: PythonEnvironment_PythonApi, + interpreter: Environment, allowExceptions?: boolean ): Promise; /** diff --git a/src/platform/interpreter/environmentActivationService.node.ts b/src/platform/interpreter/environmentActivationService.node.ts index cd1c2d56ad1..d84b797b5e3 100644 --- a/src/platform/interpreter/environmentActivationService.node.ts +++ b/src/platform/interpreter/environmentActivationService.node.ts @@ -18,7 +18,6 @@ import { KernelProgressReporter } from '../progress/kernelProgressReporter'; import { Telemetry } from '../common/constants'; import { ignoreLogging, logValue, traceDecoratorVerbose, traceError, traceVerbose, traceWarning } from '../logging'; import { TraceOptions } from '../logging/types'; -import { pythonEnvToJupyterEnv, serializePythonEnvironment } from '../api/pythonApi'; import { GlobalPythonExecutablePathService } from './globalPythonExePathService.node'; import { noop } from '../common/utils/misc'; import { CancellationToken, workspace } from 'vscode'; @@ -166,22 +165,16 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi let failureEx: Error | undefined; let env = await this.apiProvider.getApi().then((api) => - api - .getActivatedEnvironmentVariables( - resource, - serializePythonEnvironment(pythonEnvToJupyterEnv(environment))!, - false - ) - .catch((ex) => { - traceError( - `Failed to get activated env variables from Python Extension for ${getDisplayPath( - environment.path - )}`, - ex - ); - reasonForFailure = 'failedToGetActivatedEnvVariablesFromPython'; - return undefined; - }) + api.getActivatedEnvironmentVariables(resource, environment, false).catch((ex) => { + traceError( + `Failed to get activated env variables from Python Extension for ${getDisplayPath( + environment.path + )}`, + ex + ); + reasonForFailure = 'failedToGetActivatedEnvVariablesFromPython'; + return undefined; + }) ); if (token?.isCancellationRequested) { return; From 66645252552a8c2aa7f9c2383f18d2ee942610e7 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 10 Apr 2024 07:47:13 +1000 Subject: [PATCH 2/2] Update version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index bf955097fec..cbef565d359 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jupyter", - "version": "2024.3.0", + "version": "2024.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jupyter", - "version": "2024.3.0", + "version": "2024.3.1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index cd37b679c97..cf54479e3b4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jupyter", "displayName": "Jupyter", - "version": "2024.3.0", + "version": "2024.3.1", "description": "Jupyter notebook support, interactive programming and computing that supports Intellisense, debugging and more.", "publisher": "ms-toolsai", "author": {