Hosting interactive jupyter HTML file (with ipywidgets) on github as web page?

ipywidgets aren’t going to work as they need the active kernel.

“Jupyter interactive widgets are interactive elements, think sliders, text boxes, buttons, that have representations both in the kernel (place where code is executed) and the front-end (the Notebook web interface). To do this, a clean, well-abstracted communication layer must exist.” - Source

You can though actually host the notebooks on Github and launch them via MyBinder without deploying a server yourself, even without the notebook showing if you use the Voila dashboard as a display choice. You can see several examples of this here at the Voila Gallery. Click on any many part of the tiles representing any of the examples and they will launch via MyBInder for free. The repositories you can get by clicking ‘Source’ below each tile at the Gallery show what is necessary to archive those notebooks on Github and have them be launchable. There is no need to export the HTML to do this.

Alternatively, check out the nbinteract package.

" nbinteract is a Python package that provides a command-line tool to generate interactive web pages from Jupyter notebooks. It allows Jupyter widgets to remain interactive even when the notebook is converted to static HTML by using Binder servers as the computational backend."

Given your description, nbinteract indeed may be what you seek; however, I don’t have experience with it and so I naturally lean towards Voila.
Plus:

" Currently, nbinteract is in an alpha stage because of its quickly-changing API." - Source.



Panel is related to the dashboarding option I first discussed. Different developers. It also has the similar issues regarding the widgets needing Python backing though, as you can gather from this text:

“If your development environment offers embedded Python processes but does not support ipywidgets or Jupyter “comms” (communication channels), you will notice that some or all interactive functionality is missing. Some widgets that operate only in JavaScript will work fine, but others require communication channels between JavaScript and Python. In such cases you can either request ipywidgets or Panel support from the editor or environment, or else use the Editor + Server approach above.” - Source

2 Likes