Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
824b22d
ref: extract shared method for package changes
edvilme May 21, 2026
9d79f4b
ref: Extract updatePackagesAndNotify
edvilme May 21, 2026
36e85da
ref: Streamline refreshPackages
edvilme May 21, 2026
ebb1676
add: PackageManager::setPackages method
edvilme May 21, 2026
cca4a6a
Lint
edvilme May 21, 2026
e093f6b
Optimize getPackageChanges
edvilme May 21, 2026
fe6390e
Fix tests
edvilme May 21, 2026
06fb08c
Address PR comments
edvilme May 21, 2026
031a9c4
Rename pipPackageManager.ts
edvilme May 21, 2026
706ba84
Rename execPipList
edvilme May 21, 2026
33bb98b
Condense fetchPackages and getPakages methods into getPackages
edvilme May 28, 2026
6dbe30a
Remove setPackages
edvilme May 28, 2026
1fb35b6
Formatting
edvilme May 28, 2026
03cd8f0
Fix tests
edvilme May 28, 2026
27afdf4
Address PR comments
edvilme May 29, 2026
c72a581
Merge branch 'main' into vscode-python-environments-package-refactor
edvilme Jun 10, 2026
b7408d2
Merge branch 'main' into vscode-python-environments-package-refactor
edvilme Jun 10, 2026
e37a89d
Merge branch 'main' into vscode-python-environments-package-refactor
edvilme Jun 11, 2026
9d8fca8
Rename execPipList
edvilme May 21, 2026
d755c4f
Implement direct package discovery in all managers
edvilme May 22, 2026
59224c1
Rename method and refresh
edvilme May 28, 2026
6fb028c
Sort packages by depth
edvilme May 28, 2026
64a21e4
Update package tree item view
edvilme May 28, 2026
e6467d6
Disable commands on transitive packages
edvilme Jun 10, 2026
182660b
feature: Manage package versions from sidebar
edvilme May 7, 2026
7621384
validate version pep440
edvilme May 8, 2026
fc6befa
Version guards
edvilme May 8, 2026
af0b979
Add mechanisms for getting package versions
edvilme May 8, 2026
82cc4aa
Add mechanism for uv
edvilme May 11, 2026
f954edc
Improve comments
edvilme May 11, 2026
9fce727
Address pr comments
edvilme May 11, 2026
ea9d7b0
Update semver versions
edvilme May 11, 2026
4ee35e9
Address pr comments
edvilme May 11, 2026
df46bcf
Address pr comments
edvilme May 11, 2026
90cf8cd
Use renovatebot/pep440
edvilme May 11, 2026
f243f9e
Add formatInstalSpec for custom package-version strings used by diffe…
edvilme May 12, 2026
22bf7bc
Use poetry package[at]version syntax
edvilme May 12, 2026
9692bde
Address pr comments
edvilme May 12, 2026
6f82b09
Add python version
edvilme May 16, 2026
43e9bc1
Rename managePackageVersions command
edvilme May 20, 2026
674a6b3
Apply suggestions from code review
edvilme May 21, 2026
13eae68
Apply suggestions from code review
edvilme May 21, 2026
ece95d0
Update names for consistency
edvilme May 28, 2026
0cd0822
Use pep440 package for version parsing
edvilme Jun 11, 2026
ec3e286
Pass parsed versions to commands
edvilme Jun 11, 2026
4ab6678
Fix CI build errors: replace semver with Pep440Version and fix test i…
edvilme Jun 11, 2026
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
13 changes: 13 additions & 0 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@
"@types/vscode": "^1.99.0",
"mve": "^0.1.2",
"typescript": "^5.1.3"
},
"dependencies": {
"@renovatebot/pep440": "^3.1.0"
}
}
78 changes: 75 additions & 3 deletions api/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import type { Pep440Version } from '@renovatebot/pep440';
import {
Disposable,
Event,
Expand All @@ -20,6 +21,7 @@ import {
* This is the public API for other extensions to interact with the Python Environments extension.
*/

export type { Pep440Version } from '@renovatebot/pep440';
/**
* The path to an icon, or a theme-specific configuration of icons.
*/
Expand Down Expand Up @@ -677,20 +679,57 @@ export interface PackageManager {
/**
* Retrieves the list of packages for the specified Python environment.
* @param environment - The Python environment for which to retrieve packages.
* @param options - Optional settings for package retrieval.
* @returns An array of packages, or undefined if the packages could not be retrieved.
*/
getPackages(environment: PythonEnvironment): Promise<Package[] | undefined>;
getPackages(environment: PythonEnvironment, options?: GetPackagesOptions): Promise<Package[] | undefined>;

/**
* Event that is fired when packages change.
*/
onDidChangePackages?: Event<DidChangePackagesEventArgs>;

/**
* Fetches the names of direct (non-transitive) packages for the specified Python environment.
* @param environment - The Python environment for which to fetch direct package names.
* @returns A promise that resolves to an array of package name strings, or undefined if not supported.
*/
fetchDirectPackageNames?(environment: PythonEnvironment): Promise<Set<string> | undefined>;

/**
* Clears the package manager's cache.
* @returns A promise that resolves when the cache is cleared.
*/
clearCache?(): Promise<void>;

/**
* Returns the version of the underlying package management tool (e.g., pip, uv, conda).
* @param environment - The Python environment context.
* @returns A promise that resolves to a {@link Pep440Version} object, or `undefined` if not available.
*/
getVersion?(environment: PythonEnvironment): Promise<Pep440Version | undefined>;

/**
* Retrieves the list of available versions for a given package.
* @param packageName - The name of the package to look up.
* @param environment - The Python environment context for the lookup.
* @returns A promise that resolves to an array of {@link Pep440Version} objects (newest first),
* or `undefined` if this manager does not support version listing.
*/
getAvailableVersions?(packageName: string, environment: PythonEnvironment): Promise<Pep440Version[] | undefined>;

Comment thread
edvilme marked this conversation as resolved.
/**
* Formats a versioned install specification for this package manager.
*
* Different package managers use different syntax (e.g. pip uses `name==version`,
* conda uses `name=version`). Implement this method to return the correct format.
* When absent, callers should default to `name==version`.
*
* @param packageName - The name of the package.
* @param version - The version string.
* @returns The install specification string (e.g. `"requests==2.31.0"` or `"requests=2.31.0"`).
*/
formatInstallSpec?(packageName: string, version: string): string;
}

/**
Expand Down Expand Up @@ -794,6 +833,17 @@ export interface DidChangePythonProjectsEventArgs {
removed: PythonProject[];
}

/**
* Options for retrieving packages from a package manager.
*/
export interface GetPackagesOptions {
/**
* When `true`, bypasses the cache and fetches the latest packages from the underlying tool.
* Defaults to `false`.
*/
skipCache?: boolean;
}

export type PackageManagementOptions =
| {
/**
Expand Down Expand Up @@ -1025,9 +1075,10 @@ export interface PythonPackageGetterApi {
* Get the list of packages in a Python Environment.
*
* @param environment The Python Environment for which the list of packages is required.
* @param options Optional settings for package retrieval.
* @returns The list of packages in the Python Environment.
*/
getPackages(environment: PythonEnvironment): Promise<Package[] | undefined>;
getPackages(environment: PythonEnvironment, options?: GetPackagesOptions): Promise<Package[] | undefined>;

/**
* Event raised when the list of packages in a Python Environment changes.
Expand Down Expand Up @@ -1059,12 +1110,33 @@ export interface PythonPackageManagementApi {
managePackages(environment: PythonEnvironment, options: PackageManagementOptions): Promise<void>;
}

export interface Pep440VersionApi {
/**
* Get the version of the package manager tool associated with the given environment.
*
* @param environment The Python Environment whose package manager version is requested.
* @returns The {@link Pep440Version} of the package manager tool, or `undefined` if not available.
*/
getPackageManagerVersion(environment: PythonEnvironment): Promise<Pep440Version | undefined>;

/**
* Get the list of available versions for a package from the package manager
* associated with the given environment.
*
* @param packageName The name of the package.
* @param environment The Python Environment context for the lookup.
* @returns An array of {@link Pep440Version} objects (newest first), or `undefined` if not supported.
*/
getAvailableVersions(packageName: string, environment: PythonEnvironment): Promise<Pep440Version[] | undefined>;
}
Comment thread
edvilme marked this conversation as resolved.

export interface PythonPackageManagerApi
extends
PythonPackageManagerRegistrationApi,
PythonPackageGetterApi,
PythonPackageManagementApi,
PythonPackageItemApi {}
PythonPackageItemApi,
Pep440VersionApi {}

export interface PythonProjectCreationApi {
/**
Expand Down
31 changes: 22 additions & 9 deletions examples/sample1/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,10 @@ export interface PackageManager {
/**
* Retrieves the list of packages for the specified Python environment.
* @param environment - The Python environment for which to retrieve packages.
* @param options - Optional settings for package retrieval.
* @returns An array of packages, or undefined if the packages could not be retrieved.
*/
getPackages(environment: PythonEnvironment): Promise<Package[] | undefined>;
getPackages(environment: PythonEnvironment, options?: GetPackagesOptions): Promise<Package[] | undefined>;

/**
* Event that is fired when packages change.
Expand Down Expand Up @@ -714,6 +715,17 @@ export interface DidChangePythonProjectsEventArgs {
removed: PythonProject[];
}

/**
* Options for retrieving packages from a package manager.
*/
export interface GetPackagesOptions {
/**
* When `true`, bypasses the cache and fetches the latest packages from the underlying tool.
* Defaults to `false`.
*/
skipCache?: boolean;
}

/**
* Options for package management.
*/
Expand Down Expand Up @@ -915,7 +927,8 @@ export interface PythonProjectEnvironmentApi {
}

export interface PythonEnvironmentManagerApi
extends PythonEnvironmentManagerRegistrationApi,
extends
PythonEnvironmentManagerRegistrationApi,
PythonEnvironmentItemApi,
PythonEnvironmentManagementApi,
PythonEnvironmentsApi,
Expand Down Expand Up @@ -949,9 +962,10 @@ export interface PythonPackageGetterApi {
* Get the list of packages in a Python Environment.
*
* @param environment The Python Environment for which the list of packages is required.
* @param options Optional settings for package retrieval.
* @returns The list of packages in the Python Environment.
*/
getPackages(environment: PythonEnvironment): Promise<Package[] | undefined>;
getPackages(environment: PythonEnvironment, options?: GetPackagesOptions): Promise<Package[] | undefined>;

/**
* Event raised when the list of packages in a Python Environment changes.
Expand Down Expand Up @@ -984,7 +998,8 @@ export interface PythonPackageManagementApi {
}

export interface PythonPackageManagerApi
extends PythonPackageManagerRegistrationApi,
extends
PythonPackageManagerRegistrationApi,
PythonPackageGetterApi,
PythonPackageManagementApi,
PythonPackageItemApi {}
Expand Down Expand Up @@ -1203,10 +1218,7 @@ export interface PythonBackgroundRunApi {
}

export interface PythonExecutionApi
extends PythonTerminalCreateApi,
PythonTerminalRunApi,
PythonTaskRunApi,
PythonBackgroundRunApi {}
extends PythonTerminalCreateApi, PythonTerminalRunApi, PythonTaskRunApi, PythonBackgroundRunApi {}

/**
* Event arguments for when the monitored `.env` files or any other sources change.
Expand Down Expand Up @@ -1255,7 +1267,8 @@ export interface PythonEnvironmentVariablesApi {
* The API for interacting with Python environments, package managers, and projects.
*/
export interface PythonEnvironmentApi
extends PythonEnvironmentManagerApi,
extends
PythonEnvironmentManagerApi,
PythonPackageManagerApi,
PythonProjectApi,
PythonExecutionApi,
Expand Down
Loading
Loading