11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License.
33
4+ import type { Pep440Version } from '@renovatebot/pep440' ;
45import {
56 Disposable ,
67 Event ,
@@ -20,6 +21,7 @@ import {
2021 * This is the public API for other extensions to interact with the Python Environments extension.
2122 */
2223
24+ export type { Pep440Version } from '@renovatebot/pep440' ;
2325/**
2426 * The path to an icon, or a theme-specific configuration of icons.
2527 */
@@ -711,6 +713,38 @@ export interface PackageManager {
711713 * @returns A promise that resolves when the cache is cleared.
712714 */
713715 clearCache ?( ) : Promise < void > ;
716+
717+ /**
718+ * Returns the version of the underlying package management tool (e.g., pip, uv, conda).
719+ * @param environment - The Python environment context.
720+ * @returns A promise that resolves to a {@link Pep440Version} object, or `undefined` if not available.
721+ */
722+ getVersion ?( environment : PythonEnvironment ) : Promise < Pep440Version | undefined > ;
723+
724+ /**
725+ * Retrieves the list of available versions for a given package.
726+ * @param environment - The Python environment context for the lookup.
727+ * @param packageName - The name of the package to look up.
728+ * @returns A promise that resolves to an array of {@link Pep440Version} objects (newest first),
729+ * or `undefined` if this manager does not support version listing.
730+ */
731+ getPackageAvailableVersions ?(
732+ environment : PythonEnvironment ,
733+ packageName : string ,
734+ ) : Promise < Pep440Version [ ] | undefined > ;
735+
736+ /**
737+ * Formats a versioned install specification for this package manager.
738+ *
739+ * Different package managers use different syntax (e.g. pip uses `name==version`,
740+ * conda uses `name=version`). Implement this method to return the correct format.
741+ * When absent, callers should default to `name==version`.
742+ *
743+ * @param packageName - The name of the package.
744+ * @param version - The version string.
745+ * @returns The install specification string (e.g. `"requests==2.31.0"` or `"requests=2.31.0"`).
746+ */
747+ formatInstallSpec ?( packageName : string , version : string ) : string ;
714748}
715749
716750/**
0 commit comments