jupyterlite / xeus

JupyterLite loader for Xeus kernels
https://jupyterlite-xeus.readthedocs.io
BSD 3-Clause "New" or "Revised" License
20 stars 11 forks source link

mounts as lists where better.. #45

Open DerThorsten opened 7 months ago

DerThorsten commented 7 months ago

I believe mounts as a List where better than comma-separated strings.

with lists I could do the following for three relatively long mounts

jupyter lite build  \
        --XeusAddon.prefix=$XEUS_PYTHON_WASM_ENV_PREFIX 
        --XeusAddon.mounts="$WASM_ENV_PREFIX/lib/python3.11/site-packages/nxtgm:/lib/python3.11/site-packages/nxtgm"
        --XeusAddon.mounts="$WASM_ENV_PREFIX/lib/nxtgm/__extra__/:/lib/"
        --XeusAddon.mounts="$WASM_ENV_PREFIX/lib/nxtgm/plugins:/lib/nxtgm/plugins"

With the comma separated this looks like the follwoing (horrible)

jupyter lite build  \
        --XeusAddon.prefix=$XEUS_PYTHON_WASM_ENV_PREFIX 
        --XeusAddon.mounts="$WASM_ENV_PREFIX/lib/python3.11/site-packages/nxtgm:/lib/python3.11/site-packages/nxtgm,XeusAddon.mounts="$WASM_ENV_PREFIX/lib/nxtgm/__extra__/:/lib/,$WASM_ENV_PREFIX/lib/nxtgm/plugins:/lib/nxtgm/plugins"

So to make this somewhat sane with the comma-separated list I have to introduce some variables and call it with the variables.

MOUNT_PYTHON_PKG="$WASM_ENV_PREFIX/lib/python3.11/site-packages/nxtgm:/lib/python3.11/site-packages/nxtgm"
MOUNT_LIBNXTGM="$WASM_ENV_PREFIX/lib/nxtgm/__extra__/:/lib/"
MOUNT_NXTGM_PLUGINS="$WASM_ENV_PREFIX/lib/nxtgm/plugins:/lib/nxtgm/plugins"

# jupyterlite
jupyter lite build \
        --XeusAddon.prefix=$XEUS_PYTHON_WASM_ENV_PREFIX \
        --XeusAddon.mounts=$MOUNT_PYTHON_PKG,$MOUNT_LIBNXTGM,$MOUNT_NXTGM_PLUGINS

I suggest using a list of strings, and each entry can be comma-separated. That way we get the best of both worlds

martinRenou commented 7 months ago

Sounds good to me!