You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've read through the docs, a bunch of issues, and played around with a few of the templates (the GitHub starter and "jupyter lite" commands), but can't figure out how to do this, so maybe an area for docs improvement.
How do you access the Pyodide APIs to configure the pyodide kernel before user environments (REPL, Notebooks) are made available in JupyterLite?
In this particular case, a package I want to use is only shipped as native binaries and doesn't have a pyodide compatible build available, but can be easily provided by a JavaScript shim and registered via pyodide.registerJsModule (see https://pyodide.org/en/stable/usage/faq.html#how-do-i-create-custom-python-packages-from-javascript ), so I want to run this before-hand in the kernel at startup. How should this be done?
The text was updated successfully, but these errors were encountered:
@jtpio maybe it makes sense to add a set of pre and post scripts in jupyter-lite.json? Something like
{
"jupyter-lite-schema-version": 0,
"jupyter-config-data": {
"litePluginSettings": {
"@jupyterlite/pyodide-kernel-extension:kernel": {
"pyodideUrl": "./path/to/custom/pyodide/pyodide.js",
"packages": ["numpy", "pandas", "scipy", "matplotlib"], // Install these packages
"preKernelLoadScript": "preKernelLoadScript.js", // Run this script before kernel is loaded, with pyodide available
"postKernelLoadScript": "postKernelLoadScript.js" // Run this script after kernel is loaded
}
}
}
}
where the preKernelLoadScript.js can be something like
const preKernelLoad = async (pyodide, otherRelevantStuff) => {
// Do stuff with pyodide
}
export default preKernelLoad
I can have a look if this looks interesting.
jtpio
transferred this issue from jupyterlite/jupyterlite
Feb 14, 2024
Alternatively, it may be possible to implement such behavior as a more generic JupyterLab extension, that would work with any kernel and also with JupyterLab (just an idea, haven't checked more into the details to see if it's feasible).
I've read through the docs, a bunch of issues, and played around with a few of the templates (the GitHub starter and "jupyter lite" commands), but can't figure out how to do this, so maybe an area for docs improvement.
How do you access the Pyodide APIs to configure the pyodide kernel before user environments (REPL, Notebooks) are made available in JupyterLite?
In this particular case, a package I want to use is only shipped as native binaries and doesn't have a pyodide compatible build available, but can be easily provided by a JavaScript shim and registered via
pyodide.registerJsModule
(see https://pyodide.org/en/stable/usage/faq.html#how-do-i-create-custom-python-packages-from-javascript ), so I want to run this before-hand in the kernel at startup. How should this be done?The text was updated successfully, but these errors were encountered: