@@ -578,6 +578,11 @@ export interface PackageInfo {
578578 * The URIs associated with the package.
579579 */
580580 readonly uris ?: readonly Uri [ ] ;
581+
582+ /**
583+ * Whether the package is a transitive dependency.
584+ */
585+ readonly isTransitive ?: boolean ;
581586}
582587
583588/**
@@ -670,9 +675,9 @@ export interface PackageManager {
670675 /**
671676 * Refreshes the package list for the specified Python environment.
672677 * @param environment - The Python environment for which to refresh the package list.
673- * @returns A promise that resolves when the refresh is complete .
678+ * @returns A promise that resolves with the refreshed list of packages, or undefined .
674679 */
675- refresh ( environment : PythonEnvironment ) : Promise < void > ;
680+ refresh ( environment : PythonEnvironment ) : Promise < Package [ ] | undefined > ;
676681
677682 /**
678683 * Retrieves the list of packages for the specified Python environment.
@@ -687,6 +692,20 @@ export interface PackageManager {
687692 */
688693 onDidChangePackages ?: Event < DidChangePackagesEventArgs > ;
689694
695+ /**
696+ * Fetches the names of direct (non-transitive) packages for the specified Python environment.
697+ *
698+ * **Caveat:** Most package managers cannot track user install intent. For pip, this uses
699+ * `pip list --not-required` which returns packages with no installed dependents (leaf packages),
700+ * not necessarily packages the user explicitly installed. For example, if a user runs
701+ * `pip install flask werkzeug`, werkzeug will still be reported as transitive because flask
702+ * depends on it. This is a best-effort approximation.
703+ *
704+ * @param environment - The Python environment for which to fetch direct package names.
705+ * @returns A promise that resolves to a set of package name strings, or undefined if not supported.
706+ */
707+ getDirectPackageNames ?( environment : PythonEnvironment ) : Promise < Set < string > | undefined > ;
708+
690709 /**
691710 * Clears the package manager's cache.
692711 * @returns A promise that resolves when the cache is cleared.
@@ -1029,9 +1048,9 @@ export interface PythonPackageGetterApi {
10291048 * Refresh the list of packages in a Python Environment.
10301049 *
10311050 * @param environment The Python Environment for which the list of packages is to be refreshed.
1032- * @returns A promise that resolves when the list of packages has been refreshed .
1051+ * @returns A promise that resolves with the refreshed list of packages, or undefined .
10331052 */
1034- refreshPackages ( environment : PythonEnvironment ) : Promise < void > ;
1053+ refreshPackages ( environment : PythonEnvironment ) : Promise < Package [ ] | undefined > ;
10351054
10361055 /**
10371056 * Get the list of packages in a Python Environment.
0 commit comments