-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add WASM example with JupyterLite #1623
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, small changes. But it doesn't work on windows.
~\development\pixi\examples\wasm-jupyterlite git:[wasm]
pixi run serve
Pixi task (setup_wasm in default): pixi install -e wasm
The wasm environment has been installed.
Pixi task (build in default): jupyter lite build --XeusAddon.prefix=.pixi/envs/wasm --contents=./notebooks
static:jupyter-lite.json
. pre_status:static:jupyter-lite.json
tarball: jupyterlite-app-0.3.0.tgz 13MB
output: C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\_output
lite dir: C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite
apps:
sourcemaps: True
unused packages: True
archive:archive
contents:contents
icons:icons
lite:jupyter-lite.json
mimetypes:jupyter-lite.json
serve:contents
settings:overrides
translation:translation
. status:archive:archive
[LiteBuildApp] No archive (yet): wasm-jupyterlite-jupyterlite.tgz
. status:contents:contents
contents: 1 files
. status:icons:icons
favicon files: 0 files
. status:lite:jupyter-lite.json
[LiteBuildApp] jupyter-lite.(json|ipynb): 0 files
. status:mimetypes:jupyter-lite.json
filetypes: 26
. status:serve:contents
url: http://127.0.0.1:8000/
server: stdlib
headers:
. status:settings:overrides
overrides.json: 0
. status:translation:translation
translation files: 0 files
static:output_dir
. pre_init:static:output_dir
static:unpack
. init:static:unpack
C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_core\addons\base.py:294: UserWarning: install libarchive-c for better performance when working with archives: No module named 'libarchive'
return has_optional_dependency(
federated_extensions:copy:ext:@jupyterlite/xeus
. pre_build:federated_extensions:copy:ext:@jupyterlite/xeus
contents:copy:matplotlib.ipynb
C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_core\addons\icons.py:43: UserWarning: [lite] [icons] install `jupyter_server` to copy notebook favicons: No module named 'jupyter_server'
if not self.is_sys_prefix_ignored() and has_optional_dependency(
C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_core\addons\translation.py:88: UserWarning: [lite] [translation] install `jupyterlab_server` to load translations: No module named 'jupyterlab_server'
if not self.is_sys_prefix_ignored() and has_optional_dependency(
translation:copy
. build:contents:copy:matplotlib.ipynb
. build:translation:copy
contents:contents:.
federated_extensions:patch
federated_extensions:settings
[LiteBuildApp] ERROR | [lite] [post_build] [jupyterlite-xeus] [ERR] Invalid \escape: line 4 column 10 (char 66)
Traceback (most recent call last):
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\doit_cmd.py", line 294, in run
return command.parse_execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\cmd_base.py", line 150, in parse_execute
return self.execute(params, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\cmd_base.py", line 570, in execute
return self._execute(**exec_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\cmd_run.py", line 265, in _execute
return runner.run_all(self.control.task_dispatcher())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\runner.py", line 254, in run_all
self.run_tasks(task_dispatcher)
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\runner.py", line 213, in run_tasks
node = task_dispatcher.generator.send(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\control.py", line 629, in _dispatcher_generator
next_step = node.step()
^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\control.py", line 336, in step
return next(self.generator)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\control.py", line 345, in _func
for value in decorated(*args, **kwargs):
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\control.py", line 473, in _add_task
new_tasks = generate_tasks(to_load, task_gen, ref.__doc__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\loader.py", line 390, in generate_tasks
for task_dict, x_doc in flat_generator(gen_result, gen_doc):
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\doit\loader.py", line 27, in flat_generator
for item in gen:
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_core\manager.py", line 138, in _delayed_gather
yield from _gather()
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_core\manager.py", line 131, in _gather
raise error
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_core\manager.py", line 123, in _gather
for task in getattr(addon, attr)(self):
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_xeus\add_on.py", line 127, in post_build
yield from self.copy_kernels_from_prefix()
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_xeus\add_on.py", line 174, in copy_kernels_from_prefix
kernel_binaries = get_kernel_binaries(kernel_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\site-packages\jupyterlite_xeus\add_on.py", line 46, in get_kernel_binaries
kernel_spec = json.loads(json_file.read_text(**UTF8))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ruben\development\pixi\examples\wasm-jupyterlite\.pixi\envs\default\Lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Invalid \escape: line 4 column 10 (char 66)
|
||
# build the jupyterlite app | ||
[feature.host.tasks.build] | ||
cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/wasm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the contents
CLI flag may be missing to pick up the content?
cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/wasm" | |
cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/wasm --contents files" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the file to the ./files
folder and it's picked up correctly.
However, I had to add jupyter_server
to the host environment to make things work :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok. Yes jupyter_server
is indeed needed to index the contents.
Otherwise maybe you could keep just the notebooks
folder and provide --contents notebooks
.
@ruben-arts I fixed the conflicts from before. I think this is good now :) |
This doesnt seem to work on my (windows) machine because:
Most likely one of the packages uses a symlink. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cc @ruben-arts