Skip to content

Adopt package manager command classes - #1686

Open
edvilme wants to merge 6 commits into
mainfrom
package-manager-command-adoption
Open

Adopt package manager command classes#1686
edvilme wants to merge 6 commits into
mainfrom
package-manager-command-adoption

Conversation

@edvilme

@edvilme edvilme commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Adopts the package manager command classes introduced in #1621 across Pip/UV, Conda, and Poetry.

Changes

  • Replaces existing command construction and execution paths with the new command classes.
  • Preserves existing command flags, environment targeting, version ordering, prerelease defaults, timeouts, and Poetry cwd behavior.
  • Removes superseded utility wrappers and obsolete tests tied to those utilities.
  • Adds a parametrized package-manager roundtrip integration test (install → list → direct-deps → available-versions → uninstall) driven by the public API and grouped by managerId, so future managers are covered automatically. The available-versions step is capability-guarded so it runs when the API surfaces getPackageAvailableVersions and skips gracefully otherwise.

Relationship

Testing

  • npm run compile-tests
  • npm run unittest (1,475 passing)
  • Roundtrip integration test runs in the extension host via npm run integration-test.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates Pip/UV, Conda, and Poetry package manager call sites to the newer package-manager command class layer (introduced in #1621), and removes older helper utilities/tests that those call sites depended on.

Changes:

  • Replaces ad-hoc command construction/execution with concrete command classes for Pip/UV, Conda, and Poetry.
  • Refactors Pip/Conda/Poetry package manager flows to use command objects (including progress + cancellation wiring).
  • Removes superseded parsing/execution utilities and replaces related unit tests with command-focused tests.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/test/managers/poetry/commands.unit.test.ts Adds Poetry command smoke tests (currently mostly “does not reject”).
src/test/managers/conda/commands.unit.test.ts Adds Conda command smoke tests (currently mostly “does not reject”).
src/test/managers/builtin/commands.unit.test.ts Adds Pip/UV command smoke tests (currently mostly “does not reject”).
src/test/managers/builtin/pipVersions.unit.test.ts Removes tests for the old pip-index-versions parsing helper.
src/test/managers/builtin/pipListUtils.unit.test.ts Removes tests for the old pip list / uv tree parsing helpers.
src/managers/poetry/poetryPackageManager.ts Switches Poetry package operations to command classes; refactors Poetry cwd selection into helper.
src/managers/conda/condaUtils.ts Removes superseded managePackages() helper.
src/managers/conda/condaPackageManager.ts Switches Conda package operations/list/version/available-versions to command classes.
src/managers/builtin/utils.ts Adds parsePackageSpecs() helper and removes older pip-related utility functions from this module.
src/managers/builtin/pipUtils.ts Switches installed-package enumeration to command classes; removes isPipInstallCommand().
src/managers/builtin/pipPackageManager.ts Switches pip/uv operations to command classes; refactors available versions and direct-name listing.
src/managers/builtin/pipListUtils.ts Deletes the old pip list / uv tree parsing module.
src/managers/builtin/helpers.ts Adjusts logging behavior for python stderr output.
package-lock.json Lockfile update (tslib metadata change).

Comment thread src/managers/builtin/pipPackageManager.ts
Comment thread src/managers/builtin/pipPackageManager.ts
Comment thread src/managers/builtin/utils.ts
Comment thread src/test/managers/builtin/commands.unit.test.ts Outdated
Comment thread src/test/managers/conda/commands.unit.test.ts Outdated
Comment thread src/test/managers/poetry/commands.unit.test.ts Outdated
Comment thread src/managers/builtin/helpers.ts
edvilme and others added 3 commits July 31, 2026 15:08
- pipPackageManager.manage(): rethrow CancellationError instead of swallowing
  it, so callers (e.g. venv creation's pkgInstallationCancelled) can distinguish
  cancel from failure; restores parity with main and the conda/poetry managers.
- getDirectPackageNames: fix docstring to reflect uv uses 'uv pip tree --depth=0'
  (not 'uv pip list --not-required').
- parsePackageSpecs: omit undefined version property and clarify wording.
- runPython: restore 'python:' prefix on stderr log output for consistency.
- Remove overlapping command smoke tests; the reworked, parsed-value versions
  are owned by the tests PR (#1677).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3f16397e-0917-4efb-8d75-566c71ebf9ba
Public-API-driven integration test exercising install/list/direct-deps/uninstall
for every discovered package manager, parametrized over environments grouped by
managerId so future managers are covered automatically. Consolidated into this PR
per review preference rather than a separate PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3f16397e-0917-4efb-8d75-566c71ebf9ba
Add a capability-guarded available-versions step to the package manager
roundtrip integration test. Uses an optional cast so it compiles and runs
regardless of whether the active API build surfaces the getter, and skips
the assertion for managers that resolve to undefined.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3f16397e-0917-4efb-8d75-566c71ebf9ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Code quality issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants