|
1 | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
2 | 2 | // Licensed under the MIT License. |
3 | 3 |
|
| 4 | +import type * as semver from 'semver'; |
4 | 5 | import { |
5 | 6 | Disposable, |
6 | 7 | Event, |
@@ -691,6 +692,22 @@ export interface PackageManager { |
691 | 692 | * @returns A promise that resolves when the cache is cleared. |
692 | 693 | */ |
693 | 694 | clearCache?(): Promise<void>; |
| 695 | + |
| 696 | + /** |
| 697 | + * Returns the version of the underlying package management tool (e.g., pip, conda). |
| 698 | + * @param environment - The Python environment context. |
| 699 | + * @returns A promise that resolves to a SemVer object, or `undefined` if not available. |
| 700 | + */ |
| 701 | + getVersion?(environment: PythonEnvironment): Promise<semver.SemVer | undefined>; |
| 702 | + |
| 703 | + /** |
| 704 | + * Retrieves the list of available versions for a given package. |
| 705 | + * @param packageName - The name of the package to look up. |
| 706 | + * @param environment - The Python environment context for the lookup. |
| 707 | + * @returns A promise that resolves to an array of version strings (newest first), |
| 708 | + * or `undefined` if this manager does not support version listing. |
| 709 | + */ |
| 710 | + getAvailableVersions?(packageName: string, environment: PythonEnvironment): Promise<string[] | undefined>; |
694 | 711 | } |
695 | 712 |
|
696 | 713 | /** |
@@ -1059,12 +1076,33 @@ export interface PythonPackageManagementApi { |
1059 | 1076 | managePackages(environment: PythonEnvironment, options: PackageManagementOptions): Promise<void>; |
1060 | 1077 | } |
1061 | 1078 |
|
| 1079 | +export interface PythonPackageVersionApi { |
| 1080 | + /** |
| 1081 | + * Get the version of the package manager tool associated with the given environment. |
| 1082 | + * |
| 1083 | + * @param environment The Python Environment whose package manager version is requested. |
| 1084 | + * @returns The SemVer version of the package manager tool, or `undefined` if not available. |
| 1085 | + */ |
| 1086 | + getPackageManagerVersion(environment: PythonEnvironment): Promise<semver.SemVer | undefined>; |
| 1087 | + |
| 1088 | + /** |
| 1089 | + * Get the list of available versions for a package from the package manager |
| 1090 | + * associated with the given environment. |
| 1091 | + * |
| 1092 | + * @param packageName The name of the package. |
| 1093 | + * @param environment The Python Environment context for the lookup. |
| 1094 | + * @returns An array of version strings (newest first), or `undefined` if not supported. |
| 1095 | + */ |
| 1096 | + getAvailableVersions(packageName: string, environment: PythonEnvironment): Promise<string[] | undefined>; |
| 1097 | +} |
| 1098 | + |
1062 | 1099 | export interface PythonPackageManagerApi |
1063 | 1100 | extends |
1064 | 1101 | PythonPackageManagerRegistrationApi, |
1065 | 1102 | PythonPackageGetterApi, |
1066 | 1103 | PythonPackageManagementApi, |
1067 | | - PythonPackageItemApi {} |
| 1104 | + PythonPackageItemApi, |
| 1105 | + PythonPackageVersionApi {} |
1068 | 1106 |
|
1069 | 1107 | export interface PythonProjectCreationApi { |
1070 | 1108 | /** |
|
0 commit comments