-
Notifications
You must be signed in to change notification settings - Fork 25
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
Generate pyodide repodata, add more mocks #27
Conversation
8317a2e
to
6266007
Compare
cc9391d
to
cfdd599
Compare
cfdd599
to
c370e55
Compare
f989702
to
1805a4a
Compare
ad6ad52
to
c22fd31
Compare
c22fd31
to
bd79675
Compare
I think this is ready for review. Landing this without docs feels kinda bad, not sure what to do about that. I am still not 100% convinced on:
|
Of note on benchmarking this vs the current
Both |
@@ -5,7 +5,7 @@ node_modules/ | |||
*.egg-info/ | |||
.ipynb_checkpoints | |||
*.tsbuildinfo | |||
jupyterlite_pyodide_kernel/labextension | |||
src/jupyterlite_pyodide_kernel/labextension |
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.
Do we need to move this folder in this PR? Are we expected more Python packages to be added to the repo later?
Would need to check how the releaser handles that. It probably breaks it without extra config.
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.
It would be nice to keep jupyterlite_pyodider_kernel
to the top-level for now until we really need to move it down to a nested src
folder or similar.
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.
The src
layout is widely used in a lot of packages, but i'll grant i haven't used it with the releaser.
This avoids the possibility of it shadowing the as-installed package in site-packages
. For some of the coverage stuff to work, it took weird junk like deleting the source and forcing a non--e .
install.
This layout is supported by the all the build backends at this point, and releaser probably needs to be updated, if it can't yet do that.
It is weird that PEP 621 doesn't have a canonical place that information, but that's the brave new world.
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.
Sure. For now it's probably just going to create more issues. Happy to reconsider it if we track that in another issue. So the releaser config can properly be handled.
But for now it would be nice to keep it at the top-level so we can continue making releases (also it's not really related to the main change of this PR).
Thanks @bollwyvl for porting this PR. Looking at the diff and its relative complexity, I'm wondering if this is the right approach going forward. Taking a step back, it looks like we are trying to handle package management for Pyodide here downstream? Since a couple of these packages are built-in Pyodide by default, maybe there is a way to upstream some of that? Otherwise maybe the Pyodide kernel should provide the right hooks for building and bundling the right packages at build time. Similar to what the xeus python kernel does. Probably the drawback here would be an added complexity of the build requirements as building a Pyodide distribution might not be as straightforward as pulling packages from emscripten forge and conda forge. Just thinking out loud here. |
We're working within the well-structured JSON format of It also:
That's what this does. It just doesn't change the upstream
Upstream has already made this mostly possible, by making the live repodata part of the JS and python API. Unfortunately, getting this out is still locked behind an enormous install, which is not really their problem, as they are generally concerned with full custom distributions. pyodide/pyodide#3573
which doesn't work with dynamically-installed packages (from PyPI or otherwise), last i checked.
Yep, it's pretty big, and while i am maintaining the pyodide-build-feedstock, I don't think making that even an optional dependency is going to be good play. The docs probably still stand for folk that are doing heavy things ( The complexity for resolving which packages are needed is locked in the
We could add a
|
Ok, RTD, back to building with an explicit |
Well it doesn't mean it should be ours. While improving the loading time is definitely something we want for lite users, I'm not sure doing it here at the kernel level is the right place. Of course this could be a way to iterate more easily, but likely these mocks and the handling of packages is something other users of Pyodide in general will want to have. |
Open to any other alternative that answers all the same mail. This package is only a kernel now, and provides the entire this-WASM-thing-is-a-python hallucination: where do you propose something should change? |
I guess something that builds just on top of Pyodide would be nice. Maybe it could be a side thing for now, not sure. Was also wondering about the state of reusing Emscripten Forge packages in Pyodide, or if they were still planning to more the packages out of tree (need to lookup the right issues). |
I dunno: this kernel builds on top of pyodide in a lower-level way than almost any other package (maybe Newer Leaving the Indeed: the packages I'm patching aren't really a problem for upstream IPython on a real machine, and it should certainly not make As for So basically: we either sit here, waiting for things to get more to our liking upstream and downstream, or just accept the complexity here in a single codebase, test the hell out of it, and get back to shipping new features.
I've barked up that tree a lot, and they're pretty set on wheels... even though PyPI hasn't budged on allowing uploading From an site owner/site user perspective: I think the reverse (xeus being able to use packages from PyPI, both in |
Yeah that's it. I mean this kernel is becoming quite complex now and as mentioned above it looks like a lot of what it is doing should belong somewhere else. Now that the Pyodide kernel can be iterated on and released independently from JupyterLite maybe could just bump major versions more freely if we decide to make drastic changes or move some logic out of the repo. I'll have another look at the PR soon.
Yep, I think it's close:
|
Welp, again: nothing changed upstream (or in neighboring packages) in the last week: I'd still like to be able to ship packages this way, still allowing for unplanned imports. Open to other suggestions, but still see this as something the kernel has to manage, or at least be aware of, for the time being. |
* Update to Pyodide 0.23.0a1 * Update CDN * bump bottom jupyterlite-core * bump to pyodide 0.23.0 * bump python versions in subpackages * replace upstream fixtures * fix proxy instance check * backport repo checks from #27 * more pytest config * ignore libarchive warning by env var * roll back pytest warning settings --------- Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
This was fixed in Pyodide 0.23.0 if you set MIME type to wasm, JsDelivir will happily br compress binary files. Though it depends also on where you deploy if it's not JsDelivr and whether you can set the MIME type manually. I'll try to have a look in more detail at this PR to understand what exactly you need and whether we could share more of the implementation. I mean we have been talking about micropip-related changes for some time, but someones need to work on the implementation :) and this hasn't been exactly at top of my priorities. Will try to look more into this now that 0.23 is out. |
Welp, we're strictly not in the hosting business, but enable and encourage others to do so, ideally for free, and triggered by something as simple as dragging a notebook into the Git(Lab/Hub) UI and waiting to get a site built. So hosting features that need flags, configuration, or extra accounts are not going to help those folks. I don't know enough about the inner plumbing of Git(Hub|Lab) Pages or ReadTheDocs to even document how one might might force them to do fancy MIME tricks.
Well, need is of course a big word: we already take plenty, and of course are very thankful 🤗 Basically: we'd like an owner of a jupyterlite site to be able to, offline, calculate how to replace one or more individual packages in an otherwise-full Concretely, we'd use this feature to replace just the 1mb of
There's some more detail over on pyodide/pyodide#3573 Spitballing if pip install micropip
Running, still in the server, in a directory that had my import micropip, json
repodata_patch = micropip.repodata_patch([./"jedi-0.0.0-none-any.whl"])
with open('repodata-patch.json') as fd:
json.dump(repodata_patch, fd) At runtime, after starting pyodide, the data in |
As a comparison the Xeus Python kernel for JupyterLite offloads most of the dependency management and the creation of the environment to
Could there be something similar for Pyodide? So the Pyodide kernel does not have to deal with shims, mocks and all the complexity that comes with package management? |
Yes, there have been a number of features added in |
References
repodata.json
jupyterlite#979Changes
package.json
piplite
key topyodideKernel
package.json
install_on_import
toPyodideAddon
prompt_toolkit
shimsdoit
requirements-dev.txt
, go back to RTD wheelscheck
repodataUrls
(including Pyodide's) to ensure all packages have a wheelinstall_on_import
on the demo sitepyodide-core
sqlite
)I
(isort
) toruff