-
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
Improve the wrapper kernel experience for downstreams #28
Comments
stoked to see work on this! thanks! so my hope for my an option i have, but havent tried, is to put the pidgy configuration information the in the |
Not sure what "your" means in this case... but can certainly image for a site that only has pidgy content in it... "plain old python" still doesn't quite work they way one would expect.
it... probably wouldn't work today. as mentioned above, we kinda need to make sure python works before overloading with uploaded content... one thing that is in the kernelpec "schema" is environment variables, but again, it might be too early in the lifecycle. So, coupling that, plus branding, help links, and, eventually, syntax highlighting, and downstream installability, it seems there's a fair amount of value in shipping a custom kernel that couldn't be config only.
Right, for my reference, as I haven't looked in a while: the critical chunk of import pyolite
await piplite.install(['pidgy'])
import IPython
__import__("pidgy").load_ipython_extension(IPython.get_ipython()) We've already made that part much more granular: instead of
So the It looks like And finally, we'll probably need to do a fair amount of work on the extension |
that is true. i think most folks would have a direct link (eg https://deathbeds.github.io/pidgy/branch/feb-demo/run/lab/?path=basics.ipynb). in that case, the kernel is defined in the notebook format and pidgy will work. otherwise, i'm happy with the current launcher (see figure) that will open an IPykernel that invokes the pidgy extensions, or using the pidgy kernel directly. basically, it'll do what the code snippet you shared does. a nice to have, this may be too far, is a lite repl with the pidgy kernel. could these changes help
|
Right: this is the advantage to a "real" kernelspec, etc. as this should already work, provided a new-enough jupyterlite that ships the REPL app. Pursuing this line of thought: really anything that changes the mime type from Indeed, For a truly lightweight, no-webpack kernel, I could imagine a "Put a single JSON in We'd have the "well-known" (but not schema-described) kernelspec to play with, as well as the (also not schema-constrained) # kernlspecs/pidgy/kernel.json
{
"name": "pidgy",
"display_name": "Pidgy (Pyodide)",
"language": "markdown",
"mimetype": "text/pidgy+markdown",
"argv": [],
"resource_dir": {
"logo-32x32": "data:...",
"logo-64x64": "data:..."
},
"env": {
"PIDGY_START_KERNEL_ON_IMPORT": "1"
},
"metadata": {
"@jupyterlite/pyodide-kernel-extension": {
"kernelImportPackage": "pidgy",
"kernelImportName": "pidgy.lite",
"kernelInfoReply": {
"language_info": {},
"debugger": false,
"help_links": {}
}
}
}
} The above-mentioned future Of course, for downstreams, this could still be made packageable for PyPI with a minimal, flat repo structure which would preserve all the lovely aspects of a real package manager and
... which could also choose to handle resolving piplite Warehouse index, repodata, etc. |
super cool to know.
i guess without a schema it is hard to know what
jupyter packaging has a declarative way of sharing the kernel directory. [tool.hatch.build.targets.wheel.shared-data]
"src/kernelspec" = "share/jupyter/kernels/pidgy" would it be possible to export/configure the kernel spec in a [tool.doit.lite]
kernelspecs = ["src/pidgy-lite-spec"]]
yea i dig this. i could imagine shipping two different kernelspecs, one for lite and for IPython. for this thin wrapper over
seems cool to get there. i think for the
so i'll still have the nested directory structure somewhere. |
Oh, indeed. These definitely would not go into a real
Here and on core, we've explicitly avoided lite changing anything in
We have the addon API in place through a PEP621-compliant, versioned
Probably not going to go down the traitlets-in-js road. The intent is to get exactly one PEP423 installable package and one dotted-import-with-sideffects that replaces the current
Right, for the most part that would be the point, where a |
Problem
Today, it's possible to reuse the kernel labextension to get up to something that runs on top of all of the pyodide machinery, but it's still pretty non-trivial.
Upstream,
ipykernel
providesKernelBase
, which makes it quite easy to depend onipykernel
, and create another, separately-branded kernel which only has to override the parts you want (or the fullIPyKernel
).Proposed Solution
In this repo, or a new one, add, document, and test a cookiecutter or copier that makes it easier to build new, PyPI- and npm-distributable kernels that depend on
jupyterlite-pyodide-kernel
.Additional context
The two in-the-wild downstream kernels I've worked on are
Today, they still pretty much need to be hard forks, but with the split from
jupyterlite(_core)
, it should be much easier to do this simply now.If in a new repo, it might be a bit simpler, but runs the risk of getting out-of-date.
If this was included in-tree, it could be tested (up to CI, which is tricky without
act
-in-GHA, which is kinda nasty).copier
makes it a good deal easier to properly package these things, and could be made to extend the as-shipped CLI (behind an[extra]
, i guess).A Future Family Tree of Kernels
The text was updated successfully, but these errors were encountered: