-
Notifications
You must be signed in to change notification settings - Fork 505
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
Voilite POC #1187
Voilite POC #1187
Conversation
This is very much WIP for now, there is not much to see yet. |
21a9222
to
cb28723
Compare
Sorry for the wild rebases/squashes. I was cleaning up the PR quite a bit. It's not yet ready for review. |
@martinRenou do you have anything in the pipeline? Can rebase and play around with this PR? |
Feel free to do it :) I pushed all I have here. It's not complete, and not working. |
voila/voilite/app.py
Outdated
def copy_static_files(self, page_config: Dict) -> None: | ||
|
||
lite_static_path = os.path.join( | ||
os.path.dirname(os.path.realpath(__file__)), 'static' | ||
) | ||
dest_static_path = os.path.join(os.getcwd(), 'voila') | ||
if os.path.isdir(dest_static_path): | ||
shutil.rmtree(dest_static_path) | ||
copy_tree( | ||
os.path.join(lite_static_path, 'voila'), | ||
os.path.join(dest_static_path, 'static'), | ||
) | ||
shutil.move( | ||
os.path.join(dest_static_path, 'static', 'pypi'), | ||
os.path.join(dest_static_path, 'build', 'pypi'), | ||
) | ||
shutil.copyfile( | ||
os.path.join(lite_static_path, 'services.js'), | ||
os.path.join(dest_static_path, 'services.js'), | ||
) | ||
|
||
# Copy extension files | ||
labextensions_path = jupyter_path('labextensions') | ||
federated_extensions = page_config.get('federated_extensions', []) | ||
roots = tuple( | ||
os.path.abspath(os.path.expanduser(p)) + os.sep | ||
for p in labextensions_path | ||
) | ||
dest_extension_path = os.path.join( | ||
os.getcwd(), 'voila', 'labextensions' | ||
) | ||
if os.path.isdir(dest_extension_path): | ||
shutil.rmtree(dest_extension_path) | ||
for extension in federated_extensions: | ||
for root in roots: | ||
name = extension['name'] | ||
full_path = os.path.join(root, name) | ||
if os.path.isdir(full_path): | ||
copy_tree( | ||
full_path, os.path.join(dest_extension_path, name) | ||
) | ||
|
||
# Copy themes files | ||
all_themes = find_all_lab_theme() | ||
for theme in all_themes: | ||
theme_dst = os.path.join( | ||
dest_static_path, 'static', 'themes', theme[0] | ||
) | ||
copy_tree(theme[1], theme_dst) |
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.
We might be able to get rid of all this if we make it a JupyterLite addon?
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'm not very familiar with JupyterLite, does that mean Voila
will depend on JupyterLite
?
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.
The xeus python lite kernel is a good example of a JupyterLite addon: https://github.com/jupyterlite/xeus-python-kernel/blob/main/jupyterlite_xeus_python/env_build_addon.py
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.
We could probably make voilite
and voila
two specific Python packages so that we don't make voila depend on jupyterlite
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.
Frankly, I'm not a fan of splitting voila/voilite
, even at the command level.
I would love to be able to switch seamlessly between the two versions in the same voila
command. It would be even better if we can mix the two types together on the same page. For example, when we serve a directory of notebooks we can config (by voila.json
, voila.py
,...) which ones will be served by the normal voila
, and which one by the lite version.
0e75bed
to
ab3b9ad
Compare
8919dde
to
e497316
Compare
03ed782
to
fbb57e1
Compare
Many thanks @trungleduc for picking this up, will have a look soon 👍 |
There seems to be an error when passing a directory to voilite:
|
@martinRenou @jtpio to reuse |
I'm personally fine with that 👍🏽 |
Hello all, Any ideas on how to fix it? |
you can alias your |
Thanks, it worked! This is absolutely great and could allow us to easily deploy dashboards to hundreds of students simultaneously! Many thanks for all your work. I would like to suggest one potential improvement/feature although I have no idea about how hard it would be to implement. It would be great to first quickly show a cached output of the notebook/dashboard and have something signal the kernel still is loading. This way, people quickly get something to see and start exploring the dashboard instead of first having to wait and only then start discovering the content. I see it as the equivalent of the preheated kernels (although not the same, of course!). Yours thankfully, |
Thanks for your feedback, indeed the preview output is a great idea! I will take a look at it. |
Let's merge and iterate in follow-up PRs! |
As discussed with @trungleduc, we will revert this merge and create a new repository for Voilite. |
This reverts commit 0b013b4.
POC implementation for Voilite. Building on top of the lab-based PR #846
This PR implements a Voilite nbconvert exporter that will execute the code in the client using a client-side kernel.
Update 18/11
The
nbconvert
template is replaced by thevoilite
command. Users can convert a notebook into a static dashboard page withSupported options:
--theme
: Change the theme , can bedark
,light
or the full name of the JupyterLab themes.--template
: Change the template, for nowVoilite
supportslab
,gridstack
,reveal
andclassic
theme--packages
: List of packages to be installed at run time in the lite kernel.Voilite
can be configured via the CLI or thevoilite.py/voilite.json
file.Remaining tasks
classic
andreveal
templates to supportvoilite
.Add tests and documentation(will be addressed in the follow-up PR )