Demonstration with Jupyter Lab

Let’s first get a feel for the possibilities, and see what is possible by checking out some existing websites, organizations, and repositories. The idea of removing installation complexities, platform dependencies, etc. from your end-users is beautifully demonstrated by some of the recent advancements made over at Project Jupyter, all visible on their Github repository

My favorite example that demonstrates how slick this new approach to setting up programming environmnents is the repository demonstration with JupyterLab + Binder from the binder-examples repository collection.

It even has an interactive map!!!

Head on over there, click on the little badge that reads “launch | binder,” and it will automatically open up a notebook for you.1 Have a look around, run code, do whatever you like.

To then see how easy adding functionality is, run the following in a new code-cell in the notebook that opens:

!jupyter labextension install @jupyter-widgets/jupyterlab-manager 

The exclamation point tells the notebook to run the command using bash.2. Since widgets are already pre-packaged, all we have to do to enable them is to tell JupyterLab to get the necessary Javascript resources to show them to you in your client (web-browser). A bunch of dialogue should show up, and then once it finishes, replace the code you just ran with

import ipywidgets as wd

and you should see a slider pop up.

To avoid this step and ensure that the widget functionality is ready-to-go, one can fork the repository, and edit the file binder/postBuild, which runs after the initial repository is built (using repo2docker on the backend) but before the client displays the interface.

  1. Be warned: After a few minutes of inactivity, the service that is hosting the docker container which serves this web application will time-out. This means that it will assume you are done with it and clean up the resources it created for you. Say goodbye to whatever you were working on. ^
  2. Alternatively, you could open a new Terminal instance in JupyterLab and run the same code (without the exclamation mark). ^