@vscode/python-environments
v1.0.0
Published
An API facade for the Python Environments extension in VS Code
Readme
@vscode/python-environments
This package provides type declarations and a helper to access the API exposed by the Python Environments extension for VS Code.
Usage
- Install the package and add an
extensionDependenciesentry in your extension'spackage.json:
// package.json
{
"extensionDependencies": ["ms-python.vscode-python-envs"]
}- Install the npm package:
npm install @vscode/python-environments- Import and use the API in your extension:
import { PythonEnvironments } from '@vscode/python-environments';
export async function activate() {
const api = await PythonEnvironments.api();
// Get all discovered environments
const envs = await api.getEnvironments('all');
for (const env of envs) {
console.log(env.displayName, env.version);
}
}