Skip to content

Commit 05f44f3

Browse files
committed
Add formatInstalSpec for custom package-version strings used by different package managers
1 parent c27641a commit 05f44f3

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

api/src/main.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,19 @@ export interface PackageManager {
709709
* or `undefined` if this manager does not support version listing.
710710
*/
711711
getAvailableVersions?(packageName: string, environment: PythonEnvironment): Promise<Pep440Version[] | undefined>;
712+
713+
/**
714+
* Formats a versioned install specification for this package manager.
715+
*
716+
* Different package managers use different syntax (e.g. pip uses `name==version`,
717+
* conda uses `name=version`). Implement this method to return the correct format.
718+
* When absent, callers should default to `name==version`.
719+
*
720+
* @param packageName - The name of the package.
721+
* @param version - The version string.
722+
* @returns The install specification string (e.g. `"requests==2.31.0"` or `"requests=2.31.0"`).
723+
*/
724+
formatInstallSpec?(packageName: string, version: string): string;
712725
}
713726

714727
/**

0 commit comments

Comments
 (0)