-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Install non-pure package dependencies with micropip #179
Comments
I'm having trouble understanding your proposal. Can you highlight the ways in which what you are suggesting is distinct from the current behavior? |
Are you asking for a Pyodide to depend on a package from pypi but not on a locked version of it? |
Sorry for being unclear. The two changes that I would like to experiment with are:
The combined effect would be a relaxation and hardening of dependency resolution: Pyodide-built packages would be hard requirements, but their PyPi dependencies would have the same relaxed bounds (that are specified e.g. in their |
My ask here is mostly for pointers as to how I could hack this behaviour together. I first want to see how this would feel in practice before proposing it as a change to upstream Pyodide + micropip. |
I think I could change the following micropip/micropip/transaction.py Lines 175 to 189 in 5ce6e1f
to
micropip/micropip/transaction.py Lines 251 to 271 in 5ce6e1f
|
Thanks for the suggestion. There was a similar discussion about this (pyodide/pyodide#2580). I just noticed that you were also in the loop, so probably you'll be already aware of that.
Because dependency resolution is a heavy process, we rely on the lock file to speed up the package installation, and micropip uses a very heuristic dependency resolver that is fast but inaccurate. I am +1 to make it more flexible, so that users can control the dependency resolution process. There is a proposal about that #112. I am still trying to figure out what kind of interface will satisfy all users without being too complicated, but if you have any thoughts on this, please feel free to comment.
Currently, I think one possible option to satisfy your need without hacking micropip is to,
|
That's a good idea actually, I hadn't thought of it before. Do you perhaps have a link to share for how to set one up? Given that this index would only need to host the few patched or binary wheels, it wouldn't need to be anything fancy, just enough for the (basic?) JSON API (?, I'm in unfamiliar territory now). I would then run micropip with my index first, then PyPi, and then the stripped Pyodide, and I might still patch micropip so that if a package exists in my custom index by name (but not with the right version), it fails instead of checking PyPi. Does micropip already check that packages from an index have a compatible ABI (to deal with the ~yearly ABI breakage from Pyodide)? |
|
This was a fantastic suggestion! At pyodide built time, I now create a simple JSON API index that just refers to the existing Pyodide-built wheels. Installing from it works well, a great start! |
I'd like to experiment with the following setup:
pure Python packages without patches (where installing with micropip works) are removed from the Pyodide distro
for packages inside the Pyodide distro, micropip refuses to install a separate version, even if the package isn't loaded yet, i.e. if the package is requested as a dependency it's either the Pyodide-built version or nothing (even for pure wheels, since they [may] contain patches)
micropip is used to install the dependencies (expect for unpackaged dynlib dependencies) of Pyodide-built packages (using the metadata as with any other wheel), so pure and unpatched dependencies are fetched from PyPi and non-pure or patches dependencies come from Pyodide as described above
Would it be possible to hack this together, if so could you give some pointers for the micropip side?
My motivation is that I want to explore allowing users to come with a requirements file and installing that. Any non-pure or patched packages would be "anchors" that cannot be overridden, but any pure package with overlapping constraints could be installed (and since pure packages would no longer be part of the Pyodide distro this group would be much larger).
Thanks for your help!
The text was updated successfully, but these errors were encountered: