Binder and Voila to display Jupyter Notebooks

One of the things I’ve become interested in is how to use Jupyter notebooks to create an end product that is a little more useful to non-coders.

My data science students use Jupyter notebooks for their projects and it is perfect for this. I want them to also have options for sharing their results with audiences that don’t want to see the code.

At the end of each cohort they share their capstone projects with employers and I want to enable them to share something beyond just a slide show.

This is where Voila is the perfect solution. Voila renders the notebook without the code to create great data visualizations.

Combine this with Binder and it makes it easy to share.

I decided to try this out and here is an example using a super basic Jupyter notebook I had on Github for a demo.

I added a requirements.txt file to the repo with the needed libraries for the project plus voila which I think is needed to make this work right with binder.

voila
numpy 
matplotlib

Binder is a site that will take a link to a git repository with Jupyter notebooks and “open those notebooks in an executable environment, making your code immediately reproducible by anyone, anywhere.”

With a small tweek it will launch notebooks with Voila.

  • Enter in the name of the GitHub repo
  • Select URL instead of File
  • Enter in voila/render/notebook.ipynb
  • Click ‘launch’
  • Be patient- it takes a little time to build the first time

It will provide a URL you can use to share your Binder with others. Here’s the one from my Stack Plot Example:

https://mybinder.org/v2/gh/KylaBendt/stack-plot/HEAD?urlpath=voila%2Frender%2Fstack-plot.ipynb

This isn’t the best example because this notebooks prints some output that is pretty useless in this context. My output is also static which makes it not very exciting.

One of the cool things about Voila is that you can use it with interactive ipywidgets to create some really interesting things.

I have a ton of Jupyter notebooks around, but one of my next goals is to create one that is specifically designed to be rendered with Voila – perhaps something map based.

(Update: I did create a couple of really simple notebooks for playing around with Voila that you can find on my Github. The README also has links to view them rendered with Voila via Binder.)

It also looks pretty interesting to use Heroku for deployment. Or to setup Voila on my own server – I’m somehow sort of obsessed with things that I have full control over.

The option to use Binder will remain a useful one though to get things up quickly and easily and to allow my students to do so without any knowledge of deployment or setting up websites.

Leave a Reply

Your email address will not be published.