Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix activated conda env vars from PythonApi (#15526) #15527

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/platform/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -64,7 +64,7 @@ export interface PythonApi {
*/
getActivatedEnvironmentVariables(
resource: Resource,
interpreter: PythonEnvironment_PythonApi,
interpreter: Environment,
allowExceptions?: boolean
): Promise<NodeJS.ProcessEnv | undefined>;
/**
Expand Down
27 changes: 10 additions & 17 deletions src/platform/interpreter/environmentActivationService.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
Loading