Skip to content

Instantly share code, notes, and snippets.

@IvanIsCoding
Created May 19, 2025 00:17
Show Gist options
  • Save IvanIsCoding/75717cade0dc6135ad002f79ee5be551 to your computer and use it in GitHub Desktop.
Save IvanIsCoding/75717cade0dc6135ad002f79ee5be551 to your computer and use it in GitHub Desktop.
Pixi for Rustworkx Deployment in JupyterLite
[project]
name = "pixi-wasm"
version = "0.1.0"
description = "Setup a pixi environment for building a jupyterlite app with WASM"
platforms = ["emscripten-wasm32", "linux-64"]
channels = ["conda-forge"]
[feature.wasm]
channels = ["https://repo.prefix.dev/emscripten-forge-dev", "https://repo.prefix.dev/conda-forge"]
platforms = ["emscripten-wasm32"]
[feature.wasm.dependencies]
# we always need the xeus-python kernel for jupyterlite
xeus-python = "*"
python = "*"
# add any extra packages from emscripten-forge here
matplotlib = "*"
rustworkx = ">=0.17.0a3,<0.18"
[feature.host]
channels = ["https://repo.prefix.dev/conda-forge"]
platforms = ["linux-64"]
dependencies = { python = "*", jupyterlite-xeus = "*", jupyter_server = "*" }
# make sure that we have the WASM environment installed before building the app
[feature.host.tasks]
setup-wasm = { cmd = "pixi install -e wasm", inputs = ["pixi.lock"] }
build-dist = { cmd = "pixi run build --output-dir dist" }
# build the jupyterlite app
[feature.host.tasks.build]
cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/wasm"
depends-on = ["setup-wasm"]
outputs = ["_output"]
inputs = ["pixi.lock", "files/"]
# serve the jupyterlite app with a "simple server"
[feature.host.tasks.start]
cmd = "python -m http.server 8000 -d _output"
depends-on = ["build"]
[environments]
default = ["host"]
wasm = ["wasm"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment