Skip to content

Instantly share code, notes, and snippets.

@wolfv
Last active May 7, 2024 07:21
Show Gist options
  • Save wolfv/87d54ca24bbfb3c4ec34c9688f5c3de0 to your computer and use it in GitHub Desktop.
Save wolfv/87d54ca24bbfb3c4ec34c9688f5c3de0 to your computer and use it in GitHub Desktop.
[project]
name = "wasm"
version = "0.1.0"
description = "Setup a pixi environment for building a jupyterlite app with WASM"
authors = ["Wolf Vollprecht <w.vollprecht@gmail.com>"]
platforms = ["emscripten-wasm32", "osx-arm64", "linux-64", "win-64"]
channels = ["conda-forge"]
[feature.wasm]
# add the emscripten-forge channel to the list of channels
channels = ["https://repo.mamba.pm/emscripten-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
pillow = "*"
numpy = "*"
[feature.host]
channels = ["conda-forge"]
platforms = ["osx-arm64", "linux-64", "win-64"]
dependencies = { python = "*", jupyterlite-xeus = "*" }
# 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 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"]
# serve the jupyterlite app with a "simple server"
[feature.host.tasks.serve]
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