-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port freeze
into PackageManager
#115
Conversation
After the discussion about potentially having separate install directories in the previous PR, I've taken a look at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @RulerOfCakes!
Yes, this can be quite complicated, and I am not even sure it makes sense for Pyodide. so I think we can work on it separately later, for now you don't need to worry about making the PackageManager work independently. |
micropip/_commands/freeze.py
Outdated
|
||
|
||
def _freeze( | ||
repodata_packages: dict[str, dict[str, Any]], repodata_info: dict[str, str] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(No action required for this PR)
For better typing and test coverage, we can think of using pyodide-lock package (which generates these repodata lock file) #88.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pyodide_lock import PackageSpec, InfoSpec
else:
PackageSpec = ...
InfoSpec = ...
_freeze(packages: PackageSpec, info: InfoSpec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @RulerOfCakes!
def test_freeze(): | ||
manager = get_test_package_manager() | ||
|
||
test_repodata_info = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later, I think we can improve this by using an actual lock file structure.
Thanks @RulerOfCakes! |
After #114, I'm continuing to implement each command into
PackageManager
.As a relatively simple first change
freeze()
now uses the given state instead of the global variables.Note that the current implementation of
freeze
still reads fromimportlib.metadata.distributions()
, so it isn't completely independent from the global environment. This isn't as trivially separable as therepodata_*
variables due to certain intrinsic quirks as discussed in the previous PR, so for now I'm leaving the path/site-packages/install related elements as-is.