feat: add getPackageAvailableVersions to public API and bump API to 1.1.0 - #1682
Conversation
4f563d7 to
540d41d
Compare
Add PythonPackageGetterApi.getPackageAvailableVersions so API consumers can query a package's available versions (newest-first), delegating to the environment's package manager and resolving to undefined when unsupported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f16397e-0917-4efb-8d75-566c71ebf9ba
|
Adding "skip tests" label since this functionality already exists but is now being exposed to the public API |
Eleanor Boyd (eleanorjboyd)
left a comment
There was a problem hiding this comment.
see two items about refresh and the exported top level items
|
🔒 Automated review in progress — Stella Huang (@StellaHuang95) is auto-reviewing this PR. |
Stella Huang (StellaHuang95)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
Eleanor Boyd (eleanorjboyd)
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous feedback. The packed-package validation still has three blocking holes:
-
The publish pipeline runs
cp ../src/api.ts src/main.ts, butapi/srcis ignored and absent from a clean checkout. The step fails before compilation unless it creates the directory first. -
api/test/consumer.tsdoes not enforce the exact public return type. Assigning an explicitly narrow implementation toPythonPackageGetterApi["getPackageAvailableVersions"]still compiles if the published contract is widened toPromise<unknown>orPromise<any>. Please assert exact type equality or call the typed API and assign its result toPromise<Pep440Version[] | undefined>. -
The package test exercises conditional
exports;require.resolve()does not prove that top-levelmainis present, andimport.meta.resolve()can resolve a missing target. Please inspect the installed package metadata and assert top-levelmainandtypesplus all referenced target files exist.
Also, normalize or realpath the expected and resolved temporary paths: on macOS Node may return /private/var/... for a test root created as /var/..., causing a false failure.
Summary
PythonPackageGetterApi.getPackageAvailableVersionsto the public API so consumers can query a package's available versions@vscode/python-environmentsfrom1.0.0to1.1.0API changes
PythonPackageGetterApi.getPackageAvailableVersions(environment, packageName): Promise<Pep440Version[] | undefined>— exposes a package's available versions (newest-first) to API consumers, delegating to the environment's package manager and resolving toundefinedwhen version listing is unsupportedPep440Versionfor package manager version APIsPackageInfo.isTransitiveandGetPackagesOptions.skipCacheGetPackagesOptionsparameter toPackageManager.getPackagesandPythonPackageGetterApi.getPackagesPackageManager.refreshandPythonPackageGetterApi.refreshPackagesto return the refreshed package list when availableValidation
npm run lintnpm run compile-testsnpm run unittest(1494passing,5pending)git diff --check