<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Jupyter Blog - Duc Trung Le</title><link href="https://jasongrout.github.io/medium-archive/pelican/" rel="alternate"/><link href="https://jasongrout.github.io/medium-archive/pelican/feeds/author-duc-trung-le.atom.xml" rel="self"/><id>https://jasongrout.github.io/medium-archive/pelican/</id><updated>2023-12-06T15:21:00+00:00</updated><subtitle>The Project Jupyter blog: news, releases, and community stories, archived from blog.jupyter.org.</subtitle><entry><title>And Voici!</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/" rel="alternate"/><published>2023-12-06T15:21:00+00:00</published><updated>2023-12-06T15:21:00+00:00</updated><author><name>Duc Trung Le</name></author><id>tag:jasongrout.github.io,2023-12-06:/medium-archive/pelican/posts/2023/and-voici/</id><summary type="html">&lt;p&gt;Scaling Jupyter dashboards up to the millions.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/images/001-1_Tjh9IaZrdJhTQzxyIOgI8Q.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;Voici (meaning “here is” in French) is a novel project reshaping Jupyter-based interactive dashboards by combining &lt;a href="/posts/2019/and-voila/"&gt;Voilà&lt;/a&gt; and &lt;a href="/posts/2021/jupyterlite-jupyter-webassembly-python/"&gt;JupyterLite&lt;/a&gt; features. It facilitates the creation of dynamic, in-browser environments for data visualization and exploration.&lt;/p&gt;
&lt;p&gt;Built upon the foundations of Voilà, Voici inherits the ability to convert any Jupyter notebook into a standalone user-friendly dashboard. While the simplicity and extensibility of Voilà are kept intact, &lt;strong&gt;Voici adopts the in-browser execution model of JupyterLite, replacing the client-server approach&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Dashboards generated by Voici are simply a collection of static files. Deploying and scaling such dashboards is straightforward since there is no need to allocate computational resources in the backend.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Voici dashboards are extraordinarily scalable compared to their “Voilà” counterparts, since they don’t require a container per user session.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Voilà and Voici, as their name suggests, share a lot of commonalities like the CLI, the configuration options, and the templating system. The difference in their execution model results in a distinction: Voilà can hide the source code from the browser, displaying only the rendered dashboard, whereas Voici exposes the entire notebook content to the front end.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="From a notebook to a Voici dashboard" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/images/002-0_pW-uDn20xeFuu6ce.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;&lt;em&gt;From a notebook to a Voici dashboard&lt;/em&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="installation-and-first-time-use"&gt;Installation and first-time use&lt;/h2&gt;
&lt;p&gt;You can install Voici using pip:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;pip&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;voici
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or using conda/mamba:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;mamba&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;voici&lt;span class="w"&gt; &lt;/span&gt;-c&lt;span class="w"&gt; &lt;/span&gt;conda-forge
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Upon installation, the Voici command-line utility becomes available and &lt;strong&gt;can be used as a drop-in replacement for the &lt;em&gt;voila&lt;/em&gt; command&lt;/strong&gt;. For example, you can generate static dashboards from a notebook or a directory of notebooks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# Build a single dashboard&lt;/span&gt;
voici&lt;span class="w"&gt; &lt;/span&gt;my-notebook.ipynb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# Build a directory of notebooks&lt;/span&gt;
voici&lt;span class="w"&gt; &lt;/span&gt;notebooks/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# Build a dashboard with a dark theme and voila-gridstack template&lt;/span&gt;
voici&lt;span class="w"&gt; &lt;/span&gt;my-notebook.ipynb&lt;span class="w"&gt; &lt;/span&gt;--template&lt;span class="w"&gt; &lt;/span&gt;gridstack&lt;span class="w"&gt; &lt;/span&gt;--theme&lt;span class="w"&gt; &lt;/span&gt;dark
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once the dashboards are built in the &lt;em&gt;_output&lt;/em&gt; directory, you can simply serve the static web page with your favorite web server. For example, using CPython’s simple HTTP server:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;python&lt;span class="w"&gt; &lt;/span&gt;-m&lt;span class="w"&gt; &lt;/span&gt;http.server&lt;span class="w"&gt; &lt;/span&gt;-d&lt;span class="w"&gt; &lt;/span&gt;_output
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="A Voici dashboard using the dark theme" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/images/003-0_26EQ9I6L6MnwIaND.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;&lt;a href="https://trungleduc.github.io/voici-stock-dashboard/voici/render/dashboard.html"&gt;&lt;em&gt;A Voici dashboard&lt;/em&gt;&lt;/a&gt; &lt;em&gt;using the dark theme&lt;/em&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;For the configurations of the themes, templates, or the tree page, you can refer to the &lt;a href="https://voila.readthedocs.io/en/stable/customize.html"&gt;Voilà documentation&lt;/a&gt; for available options. The Voici-specific configurations can be found in the &lt;a href="https://voici.readthedocs.io"&gt;Voici documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="deploy-voici-dashboard"&gt;Deploy Voici dashboard&lt;/h2&gt;
&lt;p&gt;Besides the static site hosting services, it is also possible to deploy Voici dashboards to GitHub Pages directly from your repository or to embed them into Sphinx documentation.&lt;/p&gt;
&lt;h3 id="publishing-voici-dashboards-on-github-pages"&gt;Publishing Voici dashboards on GitHub Pages&lt;/h3&gt;
&lt;p&gt;Creating your deployment on GitHub Pages is straightforward with the help of a &lt;a href="https://github.com/voila-dashboards/voici-demo"&gt;template repository&lt;/a&gt; available on GitHub. You can follow the instructions from the following video:&lt;/p&gt;
&lt;iframe src="https://www.youtube-nocookie.com/embed/ejtACmuecQg" title="Voici Dashboard Deployed on Github Pages" width="560" height="315" style="aspect-ratio: 560 / 315" loading="lazy" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;
&lt;p&gt;The dashboard will be built by the CI action and published on the corresponding GitHub page of your repository.&lt;/p&gt;
&lt;h3 id="embedding-voici-dashboards-in-sphinx-documentation"&gt;Embedding Voici dashboards in Sphinx documentation&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;jupyterlite-sphinx&lt;/em&gt; is a Python package that allows embedding Jupyterlite in Sphinx documentation using simple directives. It is used in the documentation of major projects like &lt;em&gt;scikit-image&lt;/em&gt; or &lt;em&gt;ipywidgets&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;In addition to JupyterLite applications, this package also supports embedding Voici dashboards with the &lt;a href="https://jupyterlite-sphinx.readthedocs.io/en/latest/directives/voici.html"&gt;voici directive&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;voici&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;my_notebook&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ipynb&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="ss"&gt;:height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="n"&gt;px&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="ss"&gt;:prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="no"&gt;Try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="no"&gt;Voici&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="ss"&gt;:prompt_color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;#dc3545&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With this directive, the Voici dashboard will be generated automatically with the Sphinx documentation, and the dashboard will be loaded as per user request.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="A Voici dashboard embedded in Sphinx documentation" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/images/004-0_uwgSS42KAo1EkCvF.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;A Voici dashboard embedded in Sphinx documentation&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="voici-gallery"&gt;Voici gallery&lt;/h2&gt;
&lt;p&gt;The &lt;a href="https://voila-dashboards.github.io/voici-gallery/"&gt;Voici gallery&lt;/a&gt; is a collection of dashboards built with Voici, it aims to provide a source of inspiration for crafting complex dashboards entirely based on the Jupyter ecosystem.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Voici Gallery home page" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/images/005-0_K5TYc8RPlRPBKcdU.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Voici Gallery home page&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;If you’ve created an interesting dashboard and would like to share it with a wider audience, don’t hesitate to submit a pull request &lt;a href="https://github.com/voila-dashboards/voici-gallery"&gt;here&lt;/a&gt; to have it included in the list of examples!&lt;/p&gt;
&lt;h2 id="future-development"&gt;Future development&lt;/h2&gt;
&lt;p&gt;Voici is rapidly evolving, with many improvements already in the works such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Better integration with JupyterLab and JupyterLite to preview and generate Voici dashboards from their user interface.&lt;/li&gt;
&lt;li&gt;Provide more user-friendly tools to easily deploy Voici dashboards to other platforms like GitLab and HuggingFace,…&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;User feedback from the community also plays a big role in the project roadmap. Explore Voici and share your thoughts with us using the &lt;a href="https://github.com/voila-dashboards/voici/issues"&gt;project’s GitHub issues&lt;/a&gt;!&lt;/p&gt;
&lt;h2 id="about-the-authors"&gt;About the authors&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/images/006-0_FA4jYIdu6lJ4-U4p.jpg" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/martinRenou"&gt;Martin Renou&lt;/a&gt; is a Technical Director at &lt;a href="https://quantstack.net/"&gt;&lt;strong&gt;QuantStack&lt;/strong&gt;&lt;/a&gt; and a maintainer of &lt;a href="https://jupyter.org/"&gt;&lt;strong&gt;Project Jupyter&lt;/strong&gt;&lt;/a&gt;. Among other projects Martin is a core team member of the ipywidgets project and maintains many Jupyter widget packages such as &lt;a href="https://github.com/jupyter-widgets/ipyleaflet"&gt;ipyleaflet&lt;/a&gt;, &lt;a href="https://github.com/bloomberg/ipydatagrid"&gt;ipydatagrid&lt;/a&gt;, &lt;a href="https://github.com/QuantStack/ipygany"&gt;ipygany&lt;/a&gt;, &lt;a href="https://github.com/martinRenou/ipycanvas"&gt;ipycanvas&lt;/a&gt;, and &lt;a href="https://github.com/bqplot/bqplot"&gt;bqplot&lt;/a&gt;. He is a co-creator of the &lt;a href="https://github.com/voila-dashboards/voila/"&gt;Voilà&lt;/a&gt; dashboarding system, and the &lt;a href="https://github.com/jupyter-xeus/xeus-python"&gt;xeus-python&lt;/a&gt; kernel.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/and-voici/images/007-0_TOhdhVrxFO17XsXl.jpg" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/trungleduc"&gt;Le Duc Trung&lt;/a&gt; is a Scientific Software Developer at QuantStack. He works on several projects within the Jupyter ecosystem, from the main projects like JupyterLab, Voilà, and ipywidgets to various JupyterLab extensions and widgets.&lt;/p&gt;
</content><category term="dashboards"/></entry><entry><title>Voilà 0.5.0 : Homecoming</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/" rel="alternate"/><published>2023-09-25T14:54:00+00:00</published><updated>2023-09-25T14:54:00+00:00</updated><author><name>Duc Trung Le</name></author><id>tag:jasongrout.github.io,2023-09-25:/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/</id><summary type="html">&lt;p&gt;Voila 0.5.0 is here!&lt;/p&gt;
</summary><content type="html">&lt;h2 id="voila-050-homecoming"&gt;Voilà &lt;strong&gt;0.5.0:&lt;/strong&gt; Homecoming&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/images/001-1_Oqkkz64NWqTFoS45sfprGQ.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Voilà&lt;/strong&gt;&lt;/em&gt; turns Jupyter notebooks into standalone web applications and dashboards. It provides a simple way for Jupyter users to share their work. For a detailed introduction to Jupyter’s Voilà subproject, you can check out this earlier &lt;a href="/posts/2019/and-voila/"&gt;blog post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Up until the previous version, Voilà relied on custom JavaScript code to load extension assets and handle kernel connection. However, this approach had drawbacks since it only supported the now outdated Jupyter Notebook 6 extensions.&lt;/p&gt;
&lt;p&gt;Following the launch of &lt;a href="/posts/2023/announcing-jupyter-notebook-7/"&gt;Jupyter Notebook 7&lt;/a&gt;, it is now Voilà’s turn to join the JupyterLab family. In Version 0.5.0, the front-end of Voilà has been rebuilt from scratch using JupyterLab 4.0 components, just like in the case of Notebook 7. A JupyterLab plugin-based application replaces the current custom extension loader approach. This transition enables Voilà to leverage all the latest features and enhancements available upstream.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="new-features-in-voila-050"&gt;New features in Voilà 0.5.0&lt;/h2&gt;
&lt;h3 id="extension-loading-system"&gt;Extension loading system&lt;/h3&gt;
&lt;p&gt;As of Version 0.5.0, Voilà uses the same prebuilt extension system as JupyterLab. The extension assets are loaded from local paths rather than relying on a CDN, resulting in a significant enhancement to Voilà’s extension compatibility with the rest of the JupyterLab ecosystem. This change also avoids making requests for external services. Additionally, users can now develop extensions for Voilà using the same approach as for JupyterLab extensions.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="A Voila dashboard with top bar extension and custom JupyterLab theme." src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/images/002-1_W1dHdjWC0CYoLjCWXXxU2w.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;A Voila dashboard with &lt;a href="https://github.com/voila-dashboards/voila-topbar"&gt;top bar extension&lt;/a&gt; and &lt;a href="https://github.com/timkpaine/jupyterlab_miami_nights"&gt;custom JupyterLab theme&lt;/a&gt;.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="mimetype-rendering-mechanism"&gt;Mimetype rendering mechanism&lt;/h3&gt;
&lt;p&gt;In 0.5.0, the logic for rendering cell outputs containing mimetypes has been revised, moving away from relying on &lt;code&gt;nbconvert&lt;/code&gt; and instead depending on JupyterLab mimetype renderers. This change adds support for a wide range of custom JupyterLab renderers such as &lt;code&gt;jupyterlab-fasta&lt;/code&gt;, &lt;code&gt;vega&lt;/code&gt;, &lt;code&gt;jupyterlab-geojson&lt;/code&gt;, etc.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Rendering mimetypes data in Voila" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/images/003-1_WWRmwTs5v_U8HL27JzY7Uw.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Rendering mimetypes data in Voila&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="new-tree-page"&gt;New tree page&lt;/h3&gt;
&lt;p&gt;The default tree page in Voilà has transitioned into a JupyterLab-based application incorporating the file browser widget. While the Jinja-based tree page remains available, users must opt for it using either the &lt;code&gt;--classic-tree&lt;/code&gt; CLI option or by appending &lt;code&gt;?classic-tree=True&lt;/code&gt;to the query string.&lt;/p&gt;
&lt;p&gt;The new tree page in Voilà supports JupyterLab custom themes, whereas the classic tree page is limited to light and dark themes.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="New tree page with a custom theme." src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/images/004-1_Yp5wC6yCRbCNejKtKZV8Ww.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;New tree page with a &lt;a href="https://github.com/martinRenou/jupyterlab-night"&gt;custom theme&lt;/a&gt;.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="token-based-authentication-system"&gt;Token-based authentication system&lt;/h3&gt;
&lt;p&gt;Depending on the identity provider of &lt;code&gt;jupyter-server&lt;/code&gt; 2, Voilà now supports token authentication but is disabled by default.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To start Voilà with auto-generated token:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;voila&lt;span class="w"&gt; &lt;/span&gt;--token&lt;span class="w"&gt; &lt;/span&gt;...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;To start Voilà with a personalized token:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;voila&lt;span class="w"&gt; &lt;/span&gt;--token&lt;span class="o"&gt;=&lt;/span&gt;my-secret-token&lt;span class="w"&gt; &lt;/span&gt;...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;hr&gt;
&lt;h2 id="installing-voila"&gt;Installing Voilà&lt;/h2&gt;
&lt;p&gt;Voila is available on both &lt;code&gt;PyPI&lt;/code&gt; and &lt;code&gt;conda-forge&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# Install with pip&lt;/span&gt;
pip&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;voila

&lt;span class="c1"&gt;# Install with mamba&lt;/span&gt;
mamba&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;-c&lt;span class="w"&gt; &lt;/span&gt;conda-forge&lt;span class="w"&gt; &lt;/span&gt;voila
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can try Voilà online using &lt;a href="https://voila-dashboards-voila-huggingface.hf.space/"&gt;this link&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="acknowledgments"&gt;Acknowledgments&lt;/h2&gt;
&lt;p&gt;The contributions to Voilà by &lt;a href="https://github.com/QuantStack"&gt;&lt;strong&gt;QuantStack&lt;/strong&gt;&lt;/a&gt; are supported by &lt;a href="http://www.techatbloomberg.com/"&gt;&lt;strong&gt;Bloomberg&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="about-the-contributors"&gt;About the Contributors&lt;/h2&gt;
&lt;p&gt;Voilà is an official Jupyter subproject, it has resulted from the collective efforts of &lt;a href="https://github.com/voila-dashboards/voila/graphs/contributors"&gt;numerous contributors&lt;/a&gt;. Below, we highlight the primary contributors for this release:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/images/005-0_x5BSQzmN_DVAFLc5.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/jtpio"&gt;&lt;strong&gt;Jeremy Tuloup&lt;/strong&gt;&lt;/a&gt; is a Technical Director at &lt;a href="https://twitter.com/QuantStack"&gt;QuantStack&lt;/a&gt; and a Jupyter Distinguished Contributor. Maintainer and contributor of JupyterLab, Jupyter Notebook, JupyterLite, Voilà, and projects within the Jupyter ecosystem.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/images/006-0_jOsGiBpJ5Qt2t15C.jpg" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/martinRenou"&gt;&lt;strong&gt;Martin Renou&lt;/strong&gt;&lt;/a&gt; is a Project Director at &lt;a href="https://quantstack.net/"&gt;QuantStack&lt;/a&gt; and a Jupyter Distinguished Contributor. Martin works on a variety of projects, from &lt;a href="https://github.com/QuantStack/xtensor"&gt;xtensor&lt;/a&gt; and &lt;a href="https://github.com/QuantStack/xeus-python/"&gt;xeus-python&lt;/a&gt; in C++ to &lt;a href="https://github.com/jupyter-widgets/ipywidgets"&gt;ipywidgets&lt;/a&gt;, &lt;a href="https://github.com/jupyter-widgets/ipyleaflet"&gt;ipyleaflet&lt;/a&gt; and &lt;a href="https://github.com/bqplot/bqplot"&gt;bqplot&lt;/a&gt; in Python and TypeScript.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/voila-0-5-0-homecoming/images/007-1_uSLpGo9pf1l4HIaxPFYysg.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/trungleduc"&gt;&lt;strong&gt;Le Duc Trung&lt;/strong&gt;&lt;/a&gt; is a Scientific Software Developer at QuantStack. He works on several projects within the Jupyter ecosystem, from the main projects like JupyterLab, Voilà, and ipywidgets to various JupyterLab extensions and widgets.&lt;/p&gt;
</content><category term="dashboards"/><category term="Voilà"/></entry><entry><title>Collaborative CAD in JupyterLab</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/" rel="alternate"/><published>2023-06-02T15:15:00+00:00</published><updated>2023-06-16T14:55:00+00:00</updated><author><name>Duc Trung Le</name></author><id>tag:jasongrout.github.io,2023-06-02:/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/</id><summary type="html">&lt;p&gt;We are thrilled to introduce JupyterCAD, a tool that integrates Computer-Aided Design (CAD) capabilities into JupyterLab. With its…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/001-1_9r3Xz-v5wyuz8aAKY2WV-A.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;We are thrilled to introduce &lt;a href="https://jupytercad.readthedocs.io/"&gt;JupyterCAD&lt;/a&gt;, a tool that integrates &lt;strong&gt;Computer-Aided Design&lt;/strong&gt; (CAD) capabilities into JupyterLab. With its &lt;strong&gt;JupyterLab extension&lt;/strong&gt;, dedicated &lt;strong&gt;JupyterCAD application&lt;/strong&gt;, and &lt;strong&gt;Python API for CAD operations&lt;/strong&gt;, JupyterCAD allows users to effortlessly create, edit and share 3D designs without leaving the Jupyter ecosystem.&lt;/p&gt;
&lt;p&gt;This blog post provides an overview of JupyterCAD’s features and highlights its &lt;strong&gt;collaborative editing capabilities&lt;/strong&gt; which enable teamwork in the realm of CAD.&lt;/p&gt;
&lt;p&gt;Everything that is shown below can be tested by installing JupyterCAD from PyPI:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# From PyPI&lt;/span&gt;
pip&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;jupytercad
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;hr&gt;
&lt;h2 id="one-extension-three-interfaces"&gt;One extension, three interfaces&lt;/h2&gt;
&lt;p&gt;Built using the latest JupyterLab 4 release, JupyterCAD combines CAD functionalities with the &lt;a href="/posts/2022/accelerating-jupyterlab/"&gt;enhanced performance&lt;/a&gt; and &lt;a href="/posts/2023/improving-the-accessibility-of-jupyter/"&gt;accessibility improvements&lt;/a&gt; introduced in JupyterLab 4. The flexibility of JupyterLab allows us to create the extension once but deploy it in multiple ways to target three groups of audiences: users who prefer working in the JupyterLab environment, users who favor dedicated applications, and those advanced users who do everything programmatically.&lt;/p&gt;
&lt;h3 id="jupyterlab-extension"&gt;JupyterLab Extension&lt;/h3&gt;
&lt;p&gt;Experience CAD features directly within JupyterLab with the JupyterCAD extension. Open and edit &lt;a href="https://www.freecad.org/"&gt;FreeCAD&lt;/a&gt; files, perform CAD operations, including creating 3D primitives, applying boolean operators, and exploding the view. JupyterCAD’s extension integrates seamlessly into JupyterLab, providing an intuitive environment for CAD enthusiasts and data scientists alike.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="The integrated interface of JupyterCAD inside JupyterLab" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/002-1_gnukYLJE43zcmuaEAwCuOA.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;JupyterCAD extension inside JupyterLab&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="jupytercad-application"&gt;JupyterCAD Application&lt;/h3&gt;
&lt;p&gt;For a streamlined CAD experience, JupyterCAD offers a dedicated application that eliminates distractions and emphasizes CAD features.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="An interface of the standalone JupyterCAD application" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/003-1_AcyuVpviiNtSal9Wi4CDYQ.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The standalone JupyterCAD Application.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Starting the dedicated JupyterCAD application is as simple as starting JupyterLab or Jupyter Notebook:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter&lt;span class="w"&gt; &lt;/span&gt;cad
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This dedicated application has been built in a similar way to the coming &lt;a href="https://jupyter.org/enhancement-proposals/79-notebook-v7/notebook-v7.html"&gt;Jupyter Notebook 7&lt;/a&gt;. It’s a JupyterLab “remix” built from the ground up using JupyterLab core components and custom extensions. Much like JupyterLab, it offers theming and localization support, and more planned features on the horizon.&lt;/p&gt;
&lt;h3 id="python-api-for-cad-operations"&gt;Python API for CAD Operations&lt;/h3&gt;
&lt;p&gt;Advanced users can unlock the full potential of CAD operations with JupyterCAD’s Python API. JupyterCAD allows users to programmatically visualize, create, and manipulate the shapes from a Jupyter Notebook. For example, one can open a FreeCAD file and start modifying it from the notebook with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;jupytercad&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;CadDocument&lt;/span&gt;
&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;CadDocument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;example.FCStd&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Create a cone, a sphere then cut the cone with the sphere.&lt;/span&gt;
&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_cone&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_sphere&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cut&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="An animation of using JupyterCAD python API in notebook" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/004-1_I_XVE0J8vjYne5wnsZ9WuA.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Adding object to FreeCAD file from Jupyter Notebook.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;JupyterCAD API also integrates nicely with the &lt;a href="https://github.com/tpaviot/pythonocc-core"&gt;OpenCascade Python API&lt;/a&gt;, providing expanded capabilities for working with shapes.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;jupytercad&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;CadDocument&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="c1"&gt;# Create a prism shape with OpenCascade&lt;/span&gt;
&lt;span class="n"&gt;prism&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;BRepPrimAPI_MakePrism&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vec&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Shape&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;CadDocument&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_occ_shape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prism&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="Visualize OpenCascade shape object with JupyterCAD." src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/005-1_4qvN9PdUYf5-jq5rjYUAEQ.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Visualize OpenCascade shape object with JupyterCAD.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="unlocking-teamwork-with-real-time-collaboration"&gt;Unlocking teamwork with real-time collaboration&lt;/h2&gt;
&lt;h3 id="collaborative-editing"&gt;Collaborative Editing&lt;/h3&gt;
&lt;p&gt;One of the standout features of JupyterCAD is its shared editing functionality, which seamlessly &lt;strong&gt;connects users across different interfaces within the JupyterCAD ecosystem&lt;/strong&gt;. Whether collaborators are using the dedicated JupyterCAD application, the JupyterLab extension, or working with the Python API in a Notebook, any changes made to a shared document are instantly reflected for all users.&lt;/p&gt;
&lt;p&gt;Real-time collaboration allows individuals working in the Python API to make modifications to the CAD document, while simultaneously providing a synchronized view for collaborators using the JupyterLab extension or the JupyterCAD application. This ensures that all participants have access to the most up-to-date version of the design, fostering efficient communication and &lt;strong&gt;eliminating the need for manual synchronization or file exchange&lt;/strong&gt;.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Real-time collaborative editing in JupyterCAD" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/006-1_4lDSgoYLrUqX7SQul_yXxw.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Real-time collaborative editing in JupyterCAD.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="follow-mode"&gt;Follow Mode&lt;/h3&gt;
&lt;p&gt;With JupyterCAD’s follow-mode feature, collaboration becomes even more fluid. You can follow another user’s camera movements and view adjustments in real-time. This mode allows you to gain insights into the design process, and enhance communication among team members.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Follow Mode in action." src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/007-1_DgAD-S5mvLOEK6RtDM8GZA.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Follow Mode in action.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="annotations-system"&gt;Annotations System&lt;/h3&gt;
&lt;p&gt;The annotations system in JupyterCAD adds an interactive layer to 3D designs. Now you can add annotations to specific shapes within a CAD file, give context, provide feedback, or write instructions.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Adding annotation at precise positions" src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/008-1_QD98Lrlr7_CJfgVbxHhf6w.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Adding annotation at precise positions&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;hr&gt;
&lt;h2 id="what-goes-on-under-the-hood"&gt;What goes on under the hood?&lt;/h2&gt;
&lt;p&gt;All the above features are made possible thanks to two major open-source components: &lt;a href="https://ocjs.org/"&gt;&lt;strong&gt;OpenCascade.js&lt;/strong&gt;&lt;/a&gt;, the WebAssembly build of OpenCascade, and &lt;a href="https://github.com/jupyterlab/jupyter_collaboration"&gt;&lt;strong&gt;jupyter_collaboration&lt;/strong&gt;&lt;/a&gt;, the real-time collaboration framework of JupyterLab.&lt;/p&gt;
&lt;h3 id="in-browser-geometric-modeling-kernel"&gt;In-browser geometric modeling kernel&lt;/h3&gt;
&lt;p&gt;To execute all geometric operations, JupyterCAD uses a custom build of &lt;strong&gt;OpenCascade.js,&lt;/strong&gt; which is a port of the OpenCascade library to JavaScript and WebAssembly via Emscripten. Running on a separate thread, the CAD Kernel of JupyterCAD allows users to perform complex operations at near-native speed. It also helps to lower the load of the server while serving JupyterCAD to many users.&lt;/p&gt;
&lt;h3 id="jupyterlab-real-time-collaboration-framework"&gt;JupyterLab Real-Time Collaboration framework&lt;/h3&gt;
&lt;p&gt;In JupyterLab 4, Real-Time Collaboration (RTC) is not only about editing notebooks but it has become a framework for building collaborative applications. Using the components of &lt;strong&gt;jupyter_collaboration&lt;/strong&gt; helps us accelerate the development of the RTC features in JupyterCAD. Collaborative Editing is built upon a shared data model where &lt;strong&gt;jupyter_collaboration&lt;/strong&gt; handles all the transportation and conflict resolution, while Follow Mode makes use of Awareness, a lightweight notification system provided by the library.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="future-work"&gt;Future work&lt;/h2&gt;
&lt;p&gt;The current state of JupyterCAD illustrates the capabilities of JupyterLab as a foundation to build complex applications, not just for scientific computing but also for more general technical computing applications.&lt;/p&gt;
&lt;p&gt;We will continue to improve JupyterCAD on two axes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Enhancing the 3D viewer with features to help users interact with the objects&lt;/li&gt;
&lt;li&gt;Enriching the Python API to improve interoperability with other CAD libraries&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We plan on upstreaming some of the features of JupyterCAD, like the annotations system and the Follow Mode, to jupyter_collaboration to enable it in other file contexts in JupyterLab (Notebooks, text files, etc).&lt;/p&gt;
&lt;p&gt;User feedback from the community also plays a big role in the project roadmap. Try JupyterCAD and share your feedback with us using the project’s &lt;a href="https://github.com/QuantStack/jupytercad/issues"&gt;GitHub issues&lt;/a&gt;!&lt;/p&gt;
&lt;h2 id="about-the-authors"&gt;About the Authors&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/009-0_3Y8y-PCaP2B9a6de.jpg" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/trungleduc"&gt;Le Duc Trung&lt;/a&gt; is a Scientific Software Developer at QuantStack. He works on several projects within the Jupyter ecosystem, from the main projects like JupyterLab, Voilà, and ipywidgets to various JupyterLab extensions and widgets.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/collaborative-cad-in-jupyterlab/images/010-0_A1jOuQ60SPZ_NTVv.jpg" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/martinRenou"&gt;Martin Renou&lt;/a&gt; is a Technical Director at &lt;a href="https://quantstack.net/"&gt;&lt;strong&gt;QuantStack&lt;/strong&gt;&lt;/a&gt; and a maintainer of &lt;a href="https://jupyter.org/"&gt;&lt;strong&gt;Project Jupyter&lt;/strong&gt;&lt;/a&gt;. Among other projects Martin is a core team member of the ipywidgets project and maintains many Jupyter widget packages such as &lt;a href="https://github.com/jupyter-widgets/ipyleaflet"&gt;ipyleaflet&lt;/a&gt;, &lt;a href="https://github.com/bloomberg/ipydatagrid"&gt;ipydatagrid&lt;/a&gt;, &lt;a href="https://github.com/QuantStack/ipygany"&gt;ipygany&lt;/a&gt;, &lt;a href="https://github.com/martinRenou/ipycanvas"&gt;ipycanvas&lt;/a&gt;, and &lt;a href="https://github.com/bqplot/bqplot"&gt;bqplot&lt;/a&gt;. He is a co-creator of the &lt;a href="https://github.com/voila-dashboards/voila/"&gt;Voilà&lt;/a&gt; dashboarding system, and the &lt;a href="https://github.com/jupyter-xeus/xeus-python"&gt;xeus-python&lt;/a&gt; kernel.&lt;/p&gt;
</content><category term="collaboration"/><category term="JupyterCAD"/><category term="JupyterLab"/></entry><entry><title>Need for Speed: Voilà edition</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2021/need-for-speed-voila-edition/" rel="alternate"/><published>2021-12-10T14:52:00+00:00</published><updated>2021-12-10T14:52:00+00:00</updated><author><name>Duc Trung Le</name></author><id>tag:jasongrout.github.io,2021-12-10:/medium-archive/pelican/posts/2021/need-for-speed-voila-edition/</id><summary type="html">&lt;p&gt;TL;DR: Voilà 0.3.0 is now available!&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2021/need-for-speed-voila-edition/images/001-1_gSWxQGu60SG5DdH8MIzCjw.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/posts/2019/and-voila/"&gt;Voilà&lt;/a&gt; turns Jupyter notebooks into standalone applications without requiring any modification to the content. You want to share your content with non-technical readers? Just call Voilà with the notebook to turn it into a deployable web application. The simplicity of Voilà comes at a cost: &lt;em&gt;the page load&lt;/em&gt; &lt;em&gt;time.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We set ourselves to fix this Achilles’ heel while preserving the ease-of-use of Voilà. Today we are pleased to announce the release of Voilà 0.3.0, with a focus on performance.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="motivation"&gt;Motivation&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Page load time has a critical impact on user experience of a website.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;According to &lt;a href="https://blog.kissmetrics.com/wp-content/uploads/2011/04/loading-time.pdf"&gt;Kissmetrics&lt;/a&gt;, nearly half of web users expect a site to load in 2 seconds or less, and they tend to abandon a site that is not loaded within 3 seconds.&lt;/p&gt;
&lt;p&gt;In the case of Voilà, a simple dashboard takes around one second to render and more complicated dashboards (involving libraries import, data fetching, and widgets) can easily push users out of their comfort zone. Several efforts have been made to improve the situation, from adding an execution progress indicator to enhancing the rendering technique. The load time of a medium-to-high complexity notebook has not been cut down to a desirable range yet. That is why in the 0.3.0 version, we aimed at addressing the main bottleneck of Voilà: &lt;em&gt;the execution of notebook&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id="preheated-kernels"&gt;Preheated kernels&lt;/h2&gt;
&lt;p&gt;Based upon an excellent idea of the &lt;a href="https://github.com/voila-dashboards/hotpot_km"&gt;hotpot_km&lt;/a&gt; project about the pooling hot-loaded Jupyter kernels, we implemented a new solution called “preheated kernels” to diminish the waiting time for starting a new python kernel and for executing the requested notebook.&lt;/p&gt;
&lt;p&gt;Preheated kernels can be activated just by setting the&lt;code&gt;preheat_kernel&lt;/code&gt; option to &lt;code&gt;True&lt;/code&gt;in the Voilà command line or configuration file. For example, this command will activate preheated kernels feature for the &lt;code&gt;voila.ipynb&lt;/code&gt; notebook with a pool of five kernels:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;voila voila.ipynb --preheat_kernel=True --pool_size=5
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img alt="Speed comparison between Voila 0.3.0 and 0.2.x" src="https://jasongrout.github.io/medium-archive/pelican/posts/2021/need-for-speed-voila-edition/images/002-1_djVMI5ujhEq6xVbYJNzuuA.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Speed comparison between Voilà 0.3.0 with preheated kernel and 0.2.16&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Behind the scene, the two following actions are performed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For each notebook, a queue of kernels is created and the notebook is executed in every kernel. When a new client requests a kernel, the oldest preheated kernel of the pool is used and another kernel is started asynchronously to refill the pool.&lt;/li&gt;
&lt;li&gt;The rendered HTML for the notebook is produced in advance for each preheated kernel and directly served to the client upon connection.&lt;/li&gt;
&lt;li&gt;If the kernel pool is empty, Voilà will fall back to starting a new kernel and render the notebook as usual. The advanced configurations of preheated kernels are detailed in &lt;a href="https://voila.readthedocs.io/en/latest/customize.html#preheated-kernels"&gt;Voilà’s official documentation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="partially-pre-render-notebook"&gt;Partially pre-render notebook&lt;/h2&gt;
&lt;p&gt;To benefit from the acceleration of preheated kernels mode, the notebooks need to be pre-rendered before users connect to Voilà. But in many real-world applications, the notebook requires user-specific data, which makes pre-rendering impossible. To overcome this limit, Voilà offers a feature to handle the most used method for providing user data: the URL query string.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="In preheated kernels mode, Voilà executed the first 4 cells before waiting for the query string from the user." src="https://jasongrout.github.io/medium-archive/pelican/posts/2021/need-for-speed-voila-edition/images/003-1_Gwq82pb0qAInlPUJm_-JYA.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;In preheated kernels mode, Voilà executed the first 4 cells before waiting for the query string from the user.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In normal mode, Voilà users can get the query string at run time through the &lt;code&gt;QUERY_STRING&lt;/code&gt; environment variable:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;os&lt;/span&gt;
&lt;span class="n"&gt;query_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;QUERY_STRING&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In preheated kernels mode, users can simply replace the &lt;code&gt;os.getenv&lt;/code&gt; call with the helper &lt;code&gt;get_query_string&lt;/code&gt; from &lt;code&gt;voila.utils&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;voila.utils&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;get_query_string&lt;/span&gt;
&lt;span class="n"&gt;query_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_query_string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;get_query_string&lt;/code&gt; will pause the execution of the notebook by the preheated kernel at this cell and wait for an actual user to connect to Voilà, then &lt;code&gt;get_query_string&lt;/code&gt; will return the URL query string and continue the execution of the remaining cells.&lt;/p&gt;
&lt;p&gt;To maximize the benefits of preheated kernels, the user-independent cells should be placed before the &lt;code&gt;get_query_string&lt;/code&gt;call.&lt;/p&gt;
&lt;h2 id="whats-next"&gt;What’s next?&lt;/h2&gt;
&lt;p&gt;There is more in the works to improve Voilà’s performances. Beyond kernel hot pooling, we will improve the performance of rendering Jupyter widgets in the front-end. Several of these improvements will be enabled with the upcoming 8.0 release of ipywidgets, and more optimizations are in the works.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="acknowledgments"&gt;Acknowledgments&lt;/h2&gt;
&lt;p&gt;We would like to thank &lt;a href="https://github.com/vidartf"&gt;Vidar Tonaas Fauske&lt;/a&gt; and &lt;a href="https://github.com/maartenbreddels"&gt;Maarten Breddels&lt;/a&gt; for the prior art on the &lt;a href="https://github.com/voila-dashboards/hotpot_km"&gt;hotpot_km&lt;/a&gt; project, which was an inspiration for this work in core Voilà.&lt;/p&gt;
&lt;h2 id="about-the-author"&gt;About the author&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/trungleduc"&gt;Duc Trung Le&lt;/a&gt; is a Scientific Software Developer at &lt;a href="https://twitter.com/QuantStack"&gt;QuantStack&lt;/a&gt;. He works on several projects within the Jupyter ecosystem, from the main projects like JupyterLab, Voilà, ipywidgets to Jupyter extensions and widgets.&lt;/p&gt;
</content><category term="dashboards"/><category term="Voilà"/></entry></feed>