What is the easiest way to create a webapp from an interactive Jupyter Notebook?

The Jupyter Dashboards Bundlers extension from the Jupyter Incubator is one way to do it while retaining interactivity.

EDIT: While pip installing this package will also install the cms package dependency, like dashboard_bundlers, cms needs to be explicitly enabled/quick-setup as a notebook extension for the dashboard tools to work.


I believe the easiest way is to use voilà.

After installing you just have to run:

voila <path-to-notebook> <options>

And you will have a server running your notebook as a web app, with all the input code omitted.


AppMode is "A Jupyter extension that turns notebooks into web applications".

From the README:

Appmode consist of a server-side and a notebook extension for Jupyter. Together these two extensions provide the following features:

  • One can view any notebook in appmode by clicking on the Appmode button in the toolbar. Alternatively one can change the url from baseurl/notebooks/foo.ipynb to baseurl/apps/foo.ipynb. This also allows for direct links into appmode.

  • When a notebook is opened in appmode, all code cells are automatically executed. In order to present a clean UI, all code cells are hidden and the markdown cells are read-only.

  • A notebook can be opened multiple times in appmode without interference. This is achieved by creating temporary copies of the notebook for each active appmode view. Each appmode view has its dedicated ipython kernel. When an appmode page is closed the kernel is shutdown and the temporary copy gets removed.

  • To allow for passing information between notebooks via url parameters, the current url is injected into the variable jupyter_notebook_url.


To be complete - there exists also https://www.streamlit.io/ .

I still dont understand the exact difference between voila and streamlit. At the moment I just struggle with the possibility to re-run everything with new parameters... I have bad luck with voila still.

Edit: I see that streamlit requires a raw python, not .ipynb, this fact would mean that this answer is completely wrong, I will search a bit more on streamlit before further action/comment.

Edit2: Voila looks great. However, I found few things that uncover the underlying complexity and thus a troubles that may arise.

  • callbacks. Widgets work great in jupyter, but since it is not possible to re-run one cell, sometimes the logic must be modified to work in Voila.
  • interactive java objects need a special treatment, e.g. matplotlib has a cheap solution, but there was nothing for e.g. jsroot
  • links. It is easy to create (a file and) a download link in jupyter, Voila can also serve a file, but it needs another extra treatment.

After all, I pose myself a question - is it better to learn many tricks and modifications to jupyter or to use some other system? I am going to see if streamlit can give em some answer.