You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request introduces a new architecture for Python package management in the extension, adding support for uv as a first-class package manager alongside pip. It refactors the internal routing so that package operations can be dynamically directed to either pip or uv based on user settings and environment context, and ensures that each manager only executes its own commands. The documentation is updated to describe the new behavior and configuration options.
New package manager architecture and routing:
Introduces a new BuiltInPackageManager class that routes package operations between pip and uv managers according to user configuration and environment, using the existing automatic selection rules. This enables seamless switching and explicit selection of uv for package operations.
Refactors the registration of package managers so that both pip and uv managers are registered, and the new router is used as the default package manager.
Refactoring and code simplification:
Refactors PipPackageManager to only manage packages using pip, removing all logic and command creation related to uv. The manager now delegates ownership and events to the router when wrapped. [1][2][3][4][5][6][7][8][9][10][11]
Documentation updates:
Updates the README.md to document uv as a supported package manager, describe how to select it, and clarify the routing and fallback behavior for package operations.
Internal consistency and event handling:
Ensures that package change events and package item ownership are correctly attributed to the router when PipPackageManager is wrapped, improving downstream event handling and UI consistency. [1][2][3]
Code documentation and clarity:
Adds and improves docstrings and comments throughout the new and updated classes for better maintainability and clarity. [1][2][3]
These changes lay the groundwork for robust, user-configurable Python package management in the extension, with clear separation between pip and uv and improved maintainability.
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "a1bfb53697ab8af7c83614c168c93bf36036adb09bdacf0cffeb0cddec0e3407": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "91ee3e0dfd4b65676ccd391fe56544598e75b5b7cd51ba45c720036129b900b2": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "0a32537dc51660076a1b913108f0138f881de1264b686f1bb073c080546c317d": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Both backends can publish stale package-change notifications after concurrent mutations invalidate a pending refresh.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Suppress obsolete package events after uv mutations
src/managers/builtin/pipPackageManager.ts:300
If uv mutates this environment while a pip refresh is pending, this callback can still publish changes from the obsolete inventory. updatePackagesAndNotify emits the notification before cachePackages rejects the stale generation, so an initial refresh can report a package as newly added after uv has uninstalled it. Check the captured cacheVersion before firing the event, and cover notification suppression in the concurrent-refresh test as well as cache invalidation.
Suppress stale package events after pip mutations
src/managers/builtin/uvPackageManager.ts:263
If pip mutates this environment while a uv refresh is pending, the refresh can still publish changes from its pre-mutation snapshot. updatePackagesAndNotify invokes this callback before cachePackages checks the captured generation. For example, an initial refresh can emit an add event for a package that pip has already uninstalled, even though the stale cache write is rejected. Guard this notification with cacheVersion too, and extend the concurrent-refresh test to assert that superseded refreshes emit no package-change events.
Preserve package baseline after partial uninstall failure
src/managers/builtin/pipPackageManager.ts:236
If an uninstall succeeds but the following install fails or is cancelled, these lines discard both backends' comparison baselines before updatePackagesAndNotify() runs. A subsequent refresh() compares against an empty snapshot, reporting surviving packages as additions and missing the successful removal. Preserve previousPackages as the baseline and pass it to the peer-invalidation event, while still evicting the readable inventory caches. Add a recovery-refresh assertion to the partial-failure tests.
Notify package removal after uv partial failure
src/managers/builtin/uvPackageManager.ts:213
If uv successfully uninstalls a package and the following install fails or is cancelled, these lines discard both backends' comparison baselines and execution skips the change notification. A later refresh() cannot report the removal; if the environment is now empty, it emits no event at all. Preserve previousPackages as the baseline and include it in the peer-invalidation event, without restoring it as readable cached inventory. Add a recovery-refresh assertion to the partial-failure tests.
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "e7148f613e0f14bfd0b6faaedf1297c47eefea8ec54c807bda7c0a27db417a91": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.
Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "d2ccca7bd627be1b45d60c40935a08dadba8ddd04294b1d508ba1036b0d4172e": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debtCode quality issuesreview-auto:approvedAutomated review: no blocking findings (approval posted).
6 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new architecture for Python package management in the extension, adding support for
uvas a first-class package manager alongsidepip. It refactors the internal routing so that package operations can be dynamically directed to eitherpiporuvbased on user settings and environment context, and ensures that each manager only executes its own commands. The documentation is updated to describe the new behavior and configuration options.New package manager architecture and routing:
BuiltInPackageManagerclass that routes package operations betweenpipanduvmanagers according to user configuration and environment, using the existing automatic selection rules. This enables seamless switching and explicit selection ofuvfor package operations.pipanduvmanagers are registered, and the new router is used as the default package manager.Refactoring and code simplification:
PipPackageManagerto only manage packages usingpip, removing all logic and command creation related touv. The manager now delegates ownership and events to the router when wrapped. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Documentation updates:
README.mdto documentuvas a supported package manager, describe how to select it, and clarify the routing and fallback behavior for package operations.Internal consistency and event handling:
PipPackageManageris wrapped, improving downstream event handling and UI consistency. [1] [2] [3]Code documentation and clarity:
These changes lay the groundwork for robust, user-configurable Python package management in the extension, with clear separation between
pipanduvand improved maintainability.