Skip to content
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

Micropip "dependency" resolution in a Python-only runtime #104

Open
flxmr opened this issue Apr 25, 2024 · 1 comment
Open

Micropip "dependency" resolution in a Python-only runtime #104

flxmr opened this issue Apr 25, 2024 · 1 comment

Comments

@flxmr
Copy link

flxmr commented Apr 25, 2024

So, I started using panel and would like to deploy something with their pyodide-export. As I don't want to rely on the various CDNs, I want to get all the wheels to host them myself. As there doesn't seem to be a canonical requirements-resolver in the python world (...) and pyodide-packages are not yet integrated with Pypi, I think this would eventually result in replicating micropip functionality.

I gather this is essentially what micropip.freeze does - solving this would thus also solve these problems I'd gather #68 #78. I think pyodide-pack does this too - but it uses Javascript. Or is it pyodide-lock?

So: would you be open to make micropip
a) importable in any python, so that
b) you can just run the (primitive, but better than replicated...) resolver in python to spit out a dict of wheels?
c) any ideas how to start? The things which are confusing me a lot: where are the pyodide-CDN-locations injected?, which are these? where is this documented?

So, looking into pyodide-lock, people are open to this solution: pyodide/pyodide-lock#8

@ryanking13
Copy link
Member

Hosting packages is not very hard. You can download all wheels in the Pyodide distribution, host it somewhere (that supports https://peps.python.org/pep-0691/), and update the index URL used in micropip (micropip.set_index_urls)

The tricky parts are optimizing the dependency resolution. I think pyodide-lock should be able to create a lockfile from scratch, but for now in only supports adding wheels into the existing lockfile. So users need to manually modify the URLs in the lockfile.

So I think there are a number of features that could be put into pyodide-lock to improve this, but I'm not sure what would satisfy everyone. And in the long term, I think a lot will change when it becomes possible to upload WASM packages to package indexes like PyPI.


any ideas how to start?

I think we can start with connecting micropip and pyodide-lock, so that micropip.freeze can create a pyodide-lock compatible lockfile (It may work, but we don't have tests).

Then maybe we can add more features in pyodide-lock for modifying lockfiles, so that, for example, making CDN locations can be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants