Last week, I filled an hour in a department seminar showing ways in which we could use to Jupyter notebooks to support the creation and use of interactive educational materials.
I’ve no idea if it converted anyone to the cause.
I could have done any number of other talks — about the architecture of the Jupyter ecosysytem more widely (at least, insofar as I understand), or the way in which Jupyter makes sense for reproducible research and how it fits into a containerised / virtualised way of working.
Because Jupyter is not just about notebooks.
It’s also about string and glue.
Here’s something I suddenly grokked the other day whilst chatting to somebody about different ways of accessing applications that have a graphical UI… (on a desktop, on a desktop in a VM, via
X11 (“what’s that?” they asked… sigh…), via a browser if is has an HTML UI, via
novnc in a browser window if it doesn’t (albeit w/ borked audio support); note to self – try out this
novnc Jupyter extension.): if you wrap an application that has a command line interface using metakernel, you can access it in a notebook, or JupyterLab.
This is all tied up with a couple of the Big Ideas that underlies Jupyter: firstly, that it supports the read/write web. Secondly that it supports remote code execution (and as such enables the read/write/execute web).
So for example, one of the many metakernel based kernels is the
gnuplot_kernel that lets you run Gnuplot commands from a notebook code cell and display the generated figure in a notebook. Here’s a forked version with the repo tweaked so it runs on MyBinder.
Here’s what it looks like:
(The Gnuplot code is ripped from an example in the Gnuplot docs / gallery.)
The code seems to be repeated in the output, but I guess a tweak to the ThebeLab settings, or code, may fix that. Or maybe the kernel needs a tweak. But the proof of concept is there…
Here’s the code for the web page (image file, sorry… WordPress-com editor’n’sourcecode support sucks and I get fed up faffing around with tag brackets each time I re-edit the page):
That source code image does make a second point, though… Look closely, and compare the URLs in the two images above: I can edit an HTML file via the Jupyter notebook text file editor, and also render the page as a served HTML file.
So that’s a couple more things for my colleagues to say “ah, but it won’t work for my course because…”
Bring it on…
PS the code as a gist:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">|
|<title>Thebe Lab examples</title>|
|<link rel="stylesheet" type="text/css" href="index.css" />|
|<!– Configure and load Thebe !–>|
|<!– or to use a local build: –>|
|<h1>Thebe Lab – Gnuplot demo</h1>|
|<p>Press <tt>Shift-Enter</tt> to execute the following cell. Launching the|
|computation backend may take a few seconds, and you may need to|
|If we wrap an application using metakernel, we can access it via a browser…|
|<pre data-executable="true" data-language="gnuplot">plot sin(x)</pre>|
PPS Interested in keeping up to date with Jupyter news? Sign up to the Tracking Jupyter weekly newsletter.