Refactor: Standardize PackageManager #1538
Open
edvilme wants to merge 17 commits into
Open
Conversation
PackageManager
ce7e024 to
fc73d95
Compare
Contributor
Author
|
These refactorings make adding new features to the Package Managers (e.g., #1530) much easier by properly delegating responsibilities and using clear API names. |
Member
|
This one I will need to consider more as they adjust the api surface. I would be more comfortable with a change where we instead added an optional arg to the get or manage packages that allowed you to specify if it should refresh cache. So we have the same surface generally just allows someone to specify what type of change it should be as it relates to the cache. What are your thoughts on a design like this? |
9d57c50 to
986e84a
Compare
3eefeef to
03cd8f0
Compare
Member
|
just the one question but overall looks good!! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
GetPackagesOptionsinterface to support additional options (such as cache bypassing) when retrieving Python packages from a given environment. It updates the relevant APIs, interfaces, and implementations to accept this new options parameter, and refactors the pip package manager logic to support cache skipping and code simplification. The changes are applied consistently across the main codebase and sample/example files.API and Interface Enhancements:
Added a new
GetPackagesOptionsinterface, allowing callers to specify options (currentlyskipCache) when retrieving packages. This is now accepted bygetPackagesmethods inPackageManagerandPythonPackageGetterApiinterfaces. [1] [2] [3] [4] [5] [6] [7] [8]Updated all usages and implementations of
getPackagesto accept the new optionaloptionsparameter, including inPythonEnvironmentApiImpl,InternalPackageManager, and related example/sample APIs. [1] [2] [3] [4]Pip Package Manager Refactoring and Improvements:
Renamed
pipManager.tstopipPackageManager.tsand updated imports accordingly.Refactored the pip package manager to support cache bypassing: if
options.skipCacheis set, it fetches a fresh package list instead of using the cache. Also simplified the logic for managing and refreshing packages, delegating change notification to a new shared utility. [1] [2] [3]Removed redundant code for change detection and replaced with a shared
updatePackagesAndNotifyutility. [1] [2] [3]Utilities and Supporting Changes:
execPipList) that supports additional arguments, and removed now-unnecessary helper functions. [1] [2] [3] [4]Code Style and Minor Cleanups:
These changes improve the flexibility and maintainability of the package management APIs and their implementations, preparing the codebase for future enhancements and better cache control.