diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2023-11-14 22:22:56 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2023-11-15 00:00:56 +0300 |
commit | 864f19750c3b58c8c09cfd57ef7622f6bdd38b04 (patch) | |
tree | 22714f55194144cd0be9cd4c9e0f29eb0ddb638a | |
parent | 93596df1755400c3eac5686668fd4a5d5728b474 (diff) | |
download | applause2-864f19750c3b58c8c09cfd57ef7622f6bdd38b04.tar.gz |
Jupyter integration improvements: support $APPLAUSE_OPTS and document how to display graphics and rich text
-rw-r--r-- | README.md | 21 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rwxr-xr-x | ilua-wrapper.sh | 2 |
3 files changed, 15 insertions, 11 deletions
@@ -85,7 +85,7 @@ git clone https://github.com/guysv/ilua.git --recurse-submodules cd ilua python3 -m venv env . env/bin/activate -pip install twisted==22.10.0 ilua +pip install twisted==22.10.0 . ``` You can now directly run an Applause Jupyter Console session: @@ -96,10 +96,11 @@ ilua --lua-interpreter=./applause ``` In order to tweak Applause command line parameters and be independant of the execution directory, use -the included wrapper script: +the included wrapper script. +It also allows passing in additional arguments to Applause, e.g.: ``` -ilua --lua-interpreter=./ilua-wrapper.sh +APPLAUSE_OPTS="-o 2" ilua --lua-interpreter=./ilua-wrapper.sh ``` You can symlink this to `lua` in the Python environment to make Applause the default @@ -118,19 +119,19 @@ pip install notebook Now launch a web server and follow the onscreen instructions: ``` -jupyter notebook +APPLAUSE_OPTS="-o 2" jupyter notebook --MultiKernelManager.default_kernel_name=lua ``` -In the Jupyter Notebook dashboard, when creating a new notebook, you will be asked to select the kernel. -If you choose Lua, this will in fact launch Applause (assuming that you symlinked to `lua` -as described above). +This works assuming that you symlinked `ilua-wrapper.sh` to `lua` as described above. An alternative might be to create a custom Jupyter kernel configuration (kernel.json). Please note the following restrictions/bugs: * You cannot publicly host the Jupyter Notebook as the sound is generated on the host machine. -* You cannot currently interrupt an endlessly running stream without restarting the kernel (**FIXME**) +* You cannot currently interrupt an endlessly running stream without restarting the kernel + (see this [ILua bug](https://github.com/guysv/ilua/issues/1)). * ILua does not work well with our custom Stream:tostring() metamethods * The output of other functions like Stream:toplot() is garbled. -* You cannot currently output rich text or graphics - (it would be really cool if we could display SVG generated by gnuplot in notebook cells for instance). +* You cannot currently output rich text or graphics - + it would be really cool if we could display SVG generated by gnuplot in notebook cells for instance. + There is a [workaround](https://github.com/guysv/ilua/issues/5), though. @@ -5,6 +5,9 @@ For Stream:play() this is solved differently. * The MIDIStream should be flushed when starting via Stream:play(). * There are lots of limitations with Jupyter servers (see README). + Perhaps it would be better to use xeus-lua, but that would require us to refactor everything + into a proper Lua library. + https://github.com/jupyter-xeus/xeus-lua # Features diff --git a/ilua-wrapper.sh b/ilua-wrapper.sh index 344de5d..b5494f8 100755 --- a/ilua-wrapper.sh +++ b/ilua-wrapper.sh @@ -5,4 +5,4 @@ # Thirdly, if you create a symbolic link to lua in a Python environment of ILua, this invoke # Applause by default and it will even work with Jupyter Notebooks without further tweaks. cd $(dirname $(readlink -m "$0")) -exec ./applause -o 2 "$@" +exec ./applause $APPLAUSE_OPTS "$@" |