Skip to content
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
20 changes: 20 additions & 0 deletions src/common/extVersion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { PYTHON_EXTENSION_ID } from './constants';
import { getExtension } from './extension.apis';
import { traceError } from './logging';

export function ensureCorrectVersion() {
const extension = getExtension(PYTHON_EXTENSION_ID);
if (!extension) {
return;
}

const version = extension.packageJSON.version;
const parts = version.split('.');
const major = parseInt(parts[0]);
const minor = parseInt(parts[1]);
if (major >= 2024 && minor >= 23) {
return;
}
traceError('Incompatible Python extension. Please update `ms-python.python` to version 2024.23 or later.');
throw new Error('Incompatible Python extension. Please update `ms-python.python` to version 2024.23 or later.');
}
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import { EnvVarManager, PythonEnvVariableManager } from './features/execution/en
import { StopWatch } from './common/stopWatch';
import { sendTelemetryEvent } from './common/telemetry/sender';
import { EventNames } from './common/telemetry/constants';
import { ensureCorrectVersion } from './common/extVersion';

export async function activate(context: ExtensionContext): Promise<PythonEnvironmentApi> {
const start = new StopWatch();
Expand All @@ -63,6 +64,8 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
const outputChannel: LogOutputChannel = createLogOutputChannel('Python Environments');
context.subscriptions.push(outputChannel, registerLogger(outputChannel));

ensureCorrectVersion();

// Setup the persistent state for the extension.
setPersistentState(context);

Expand Down
Loading