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

Test updated public APIs for python environments #18727

Closed
2 tasks done
karrtikr opened this issue Mar 21, 2022 · 0 comments
Closed
2 tasks done

Test updated public APIs for python environments #18727

karrtikr opened this issue Mar 21, 2022 · 0 comments

Comments

@karrtikr
Copy link

karrtikr commented Mar 21, 2022

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();
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants