Package: jupyterlite-xeus
JupyterLite XeusJupyterLite loader for Xeus kernelsRequirementsJupyterLab >= 4.0.0InstallTo install the extension, execute:pipinstalljupyterlite_xeusUsageFrom environment.yamlxeus-python kernelTo load axeus-pythonkernel with a custom environment, create anenvironment.yamlfile withxeus-pythonand the desired dependencies. Here is an example withnumpyas a additional dependency:name:xeus-lite-wasmchannels:-https://repo.mamba.pm/emscripten-forge-conda-forgedependencies:-xeus-python-numpyTo build JupyterLite, run the following command whereenvironment.yamlis the path to the file you just createdjupyterlitebuild--XeusAddon.environment_file=some_path/to/environment.yamlxeus-lua / xeus-sqlite / xeus-<mylang>To load axeus-luaorxeus-sqlitekernel you can
do the same as above, just withdependencies:-xeus-luaordependencies:-xeus-sqliteNote thatxeus-sqliteandxeus-luado not support additional dependencies yet.
To build JupyterLite, run again:jupyterlitebuild--XeusAddon.environment_file=environment.yamlMultiple kernelsTo create a deployment with multiple kernels, you can simply add them to theenvironment.yamlfile:name:xeus-lite-wasmchannels:-https://repo.mamba.pm/emscripten-forge-conda-forgedependencies:-xeus-python-xeus-lua-xeus-sqlite-numpyFrom local environment / prefixWhen developing a xeus-kernel, it is very useful to be able to test it in JupyterLite without having to publish the kernel to emscripten-forge. Therefore, you can also use a local environment / prefix to build JupyterLite with a custom kernel.Create a local environment / prefixThis workflow usually starts with creating a local conda environment / prefix for theemscripten-wasm32platform with all the dependencies required to build your kernel (here we install dependencies forxeus-python).micromambacreate-nxeus-python-dev\--platform=emscripten-wasm32\-chttps://repo.mamba.pm/emscripten-forge\-cconda-forge\--yes\"python>=3.11"pybind11nlohmann_jsonpybind11_jsonnumpypytest\bzip2sqlitezliblibffixtlpyjs\xeusxeus-liteBuild the kernelThis depends on your kernel, but it will look something like this:# path to your emscripten emsdksource$EMSDK_DIR/emsdk_env.shWASM_ENV_NAME=xeus-python-devWASM_ENV_PREFIX=$MAMBA_ROOT_PREFIX/envs/$WASM_ENV_NAME# let cmake know where the env isexportPREFIX=$WASM_ENV_PREFIXexportCMAKE_PREFIX_PATH=$PREFIXexportCMAKE_SYSTEM_PREFIX_PATH=$PREFIXcd/path/to/your/kernel/src
mkdirbuild_wasmcdbuild_wasm
emcmakecmake\-DCMAKE_BUILD_TYPE=Release\-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON\-DCMAKE_INSTALL_PREFIX=$PREFIX\..
emmakemake-j8installBuild the JupyterLite siteYou will need to create a new environment with the dependencies to build the JupyterLite site.# create new environmentmicromambacreate-nxeus-lite-host\jupyterlite-core# activate the environmentmicromambaactivatexeus-lite-host# install jupyterlite_xeus via pippython-mpipinstalljupyterlite-xeusWhen runningjupyter lite build, we pass theprefixoption and point it to the local environment / prefix we just created:jupyterlitebuild--XeusAddon.prefix=$WASM_ENV_PREFIXMounting additional filesTo copy additional files and directories into the virtual filesystem of the xeus-lite kernels you can use the--XeusAddon.mountoption.
Each mount is specified as a pair of paths separated by a colon:. The first path is the path to the file or directory on the host machine, the second path is the path to the file or directory in the virtual filesystem of the kernel.jupyterlitebuild\--XeusAddon.environment_file=environment.yaml\--XeusAddon.mounts=/some/path/on/host_machine:/some/path/in/virtual/filesystemContributingDevelopment install from a conda / mamba environmentCreate the conda environment withconda/mamba/micromamba(replacemicromambawithcondaormambaaccording to your preference):micromambacreate-fenvironment-dev.yml-nxeus-lite-devActivate the environment:micromambaactivatexeus-lite-devpython-mpipinstall-e.-v--no-build-isolationPackaging the extensionSeeRELEASE.