Skip to content

Test updated public APIs for python environments #18727

Closed
@karrtikr

Description

@karrtikr

Refs: #18357

Complexity: 3

Create Issue


Requirements

Tagging the team who previously tested #18348.

  1. Use pre release build of the python extension.
  2. Context: Multiple environments can now share the same interpreter path with Support discovering multiple conda envs with same interpreter path #18357, so interpreter path can no longer be considered as the key. For envs lacking an interpreter, path to environment folder is now considered as key, and the following type is returned via the API:

export interface EnvPathType {
/**
* Path to environment folder or path to interpreter that uniquely identifies an environment.
* Virtual environments lacking an interpreter are identified by environment folder paths,
* whereas other envs can be identified using interpreter path.
*/
path: string;
pathType: 'envFolderPath' | 'interpreterPath';
}

Test APIs exposed via IProposedExtensionAPI

  • Create two conda environments without python:
conda create -n test1
conda create -n test2

We want to make sure these can be discovered and selected.

Example usage:
Copy over contents of https://github.com/microsoft/vscode-python/blob/main/src/client/apiTypes.ts as needed.

const extension = extensions.getExtension('ms-python.python');
if (extension) {
    if (!extension.isActive) {
        await extension.activate();
    }
    const api: IExtensionApi & IProposedExtensionAPI = extension.exports as IExtensionApi & IProposedExtensionAPI;
    if (api.environment) {
        interpreterPath = await api.environment.getActiveEnvironmentPath();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions