• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pyta-uoft / python-ta-vscode-extension / 37857053450

08 Oct 2026 11:01PM UTC coverage: 51.211% (-11.2%) from 62.402%
37857053450

push

github

web-flow
Bump webpack-cli from 7.2.2 to 7.2.3 (#21)

Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 7.2.2 to 7.2.3.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@7.2.2...webpack-cli@7.2.3)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-version: 7.2.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

48 of 70 branches covered (68.57%)

Branch coverage included in aggregate %.

650 of 1293 relevant lines covered (50.27%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

49.64
/src/common/python.ts
1
import { commands, Disposable, Event, EventEmitter, Uri } from 'vscode';
1 ✔
2
import { traceError, traceLog } from './log/logging';
1 ✔
3
import { PythonExtension, ResolvedEnvironment } from '@vscode/python-extension';
1 ✔
4
import { PythonEnvironmentApi, PythonEnvironments } from '@vscode/python-environments';
1 ✔
5

1 ✔
6
export interface IInterpreterDetails {
1 ✔
7
    path?: string[];
1 ✔
8
    resource?: Uri;
1 ✔
9
}
1 ✔
10

1 ✔
11
const onDidChangePythonInterpreterEvent = new EventEmitter<IInterpreterDetails>();
1 ✔
12
export const onDidChangePythonInterpreter: Event<IInterpreterDetails> = onDidChangePythonInterpreterEvent.event;
1 ✔
13

1 ✔
14
let _api: PythonExtension | undefined;
1 ✔
15
async function getPythonExtensionAPI(): Promise<PythonExtension | undefined> {
×
16
    if (_api) {
×
17
        return _api;
×
18
    }
×
19
    _api = await PythonExtension.api();
×
20
    return _api;
×
21
}
×
22

1 ✔
23
let _envsApi: PythonEnvironmentApi | undefined;
1 ✔
24
async function getEnvironmentsExtensionAPI(): Promise<PythonEnvironmentApi | undefined> {
3 ✔
25
    if (_envsApi) {
3 ✔
26
        return _envsApi;
2 ✔
27
    }
2 ✔
28
    try {
1 ✔
29
        _envsApi = await PythonEnvironments.api();
1 ✔
30
    } catch {
3 !
31
        return undefined;
×
32
    }
×
33
    return _envsApi;
1 ✔
34
}
1 ✔
35

1 ✔
36
export async function initializePython(disposables: Disposable[]): Promise<void> {
1 ✔
37
    try {
1 ✔
38
        // // Prefer the Python Environments extension if it's available, as it provides a more comprehensive view of the available environments.
1 ✔
39
        const envsApi = await getEnvironmentsExtensionAPI();
1 ✔
40

1 ✔
41
        if (envsApi) {
1 ✔
42
            disposables.push(
1 ✔
43
                envsApi.onDidChangeEnvironment((e) => {
1 ✔
44
                    onDidChangePythonInterpreterEvent.fire({
×
45
                        path: e.new ? [e.new.execInfo.run.executable] : undefined,
×
46
                        resource: e.uri,
×
47
                    });
×
48
                }),
1 ✔
49
            );
1 ✔
50

1 ✔
51
            traceLog('Waiting for interpreter from python environments extension.');
1 ✔
52
            onDidChangePythonInterpreterEvent.fire(await getInterpreterDetails());
1 ✔
53
            return;
1 ✔
54
        }
1 ✔
55

×
56
        // Fall back to legacy ms-python.python extension API
×
57
        const api = await getPythonExtensionAPI();
×
58

×
59
        if (api) {
×
60
            disposables.push(
×
61
                api.environments.onDidChangeActiveEnvironmentPath((e) => {
×
62
                    const resource = e.resource instanceof Uri ? e.resource : e.resource?.uri;
×
63
                    onDidChangePythonInterpreterEvent.fire({ path: [e.path], resource });
×
64
                }),
×
65
            );
×
66

×
67
            traceLog('Waiting for interpreter from python extension.');
×
68
            onDidChangePythonInterpreterEvent.fire(await getInterpreterDetails());
×
69
        }
×
70
    } catch (error) {
1 !
71
        traceError('Error initializing python: ', error);
×
72
    }
×
73
}
1 ✔
74

1 ✔
75
export async function resolveInterpreter(interpreter: string[]): Promise<ResolvedEnvironment | undefined> {
1 ✔
76
    const api = await getPythonExtensionAPI();
×
77
    return api?.environments.resolveEnvironment(interpreter[0]);
×
78
}
×
79

1 ✔
80
export async function getInterpreterDetails(resource?: Uri): Promise<IInterpreterDetails> {
1 ✔
81
    // Prefer the Python Environments extension if it's available, as it provides a more comprehensive view of the available environments.
2 ✔
82
    const envsApi = await getEnvironmentsExtensionAPI();
2 ✔
83
    if (envsApi) {
2 ✔
84
        const environment = await envsApi.getEnvironment(resource);
2 ✔
85
        if (environment) {
2 !
86
            return {
×
87
                path: [environment.execInfo.run.executable],
×
88
                resource,
×
89
            };
×
90
        }
×
91
        return { path: undefined, resource };
2 ✔
92
    }
2 ✔
93

×
94
    // Fall back to legacy ms-python.python extension API
×
95
    const api = await getPythonExtensionAPI();
×
96
    const environment = await api?.environments.resolveEnvironment(
2 ✔
97
        api?.environments.getActiveEnvironmentPath(resource),
2 !
98
    );
2 ✔
99
    if (environment?.executable.uri && checkVersion(environment)) {
2 !
100
        return { path: [environment?.executable.uri.fsPath], resource };
×
101
    }
×
102
    return { path: undefined, resource };
×
103
}
×
104

1 ✔
105
export async function getDebuggerPath(): Promise<string | undefined> {
1 ✔
106
    const api = await getPythonExtensionAPI();
×
107
    return api?.debug.getDebuggerPackagePath();
×
108
}
×
109

1 ✔
110
export async function runPythonExtensionCommand(command: string, ...rest: any[]) {
1 ✔
111
    await getPythonExtensionAPI();
×
112
    return await commands.executeCommand(command, ...rest);
×
113
}
×
114

1 ✔
115
export function checkVersion(resolved: ResolvedEnvironment | undefined): boolean {
×
116
    const version = resolved?.version;
×
117
    if (version?.major === 3 && version?.minor >= 10) {
×
118
        return true;
×
119
    }
×
120
    traceError(`Python version ${version?.major}.${version?.minor} is not supported.`);
×
121
    traceError(`Selected python path: ${resolved?.executable.uri?.fsPath}`);
×
122
    traceError('Supported versions are 3.10 and above.');
×
123
    return false;
×
124
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc