An introduction to Jupyter notebooks

Post by James Slack from Edinburgh University

Apologies for the title but I used up all my imaginative title mojo for our recently accepted ALT Conference Submission Out of this World: Jupyter notebooks and Noteable at the University of Edinburgh.

Now, on to business…

There’s a very good chance that you may have heard of Jupyter before. If you’re interested in supporting digital skills, data literacy or computational teaching then it’s probably leaked into the periphery of your vision at some point. So, let’s take a step back and try to start on solid ground:

What are Jupyter notebooks?

Jupyter is an open source web application that allows you to create live editable documents – notebooks – that allow you to run code whilst also containing text, data tables and other rich media items such as images and videos. For instructors, this means you can give context alongside your code exercises or create distance learning materials. This also allows students to run, edit and experiment with code without having to open an intimidating Integrated Development Environment (IDE). It’s difficult to get your head around without seeing it:

Screenshot of Python coding in Jupyter

Adapted from “Exploratory computing with Python” by Mark Bakker. This work is licensed under a Creative Commons Attribution 4.0 International License.

Jupyter notebooks are broken up into two types of cells: Text cells and code cells. Text cells use a markdown notation to allow basic formatting and allow you to add structure and context alongside your code to create a ‘computational narrative’. The second type of cell is the code cell, the programming language is set by the kernel, this interprets the code and returns the output within the notebook. Standard Jupyter notebooks support Julia, Python and R (hence the name JUlia PYThon R) but there is now support for over 100 additional kernels to fulfil your wildest dreams. You can ‘Run’ these code cells and then see the output within the notebooks as shown above; the order in which these cells are run is recorded to make it easier to keep track of the run order. It’s not just limited to simple Print commands to output text results: You can create graphs, visualisations, work with data tables, manipulate images, and the list goes on. Really the best way to start getting your head around what Jupyter can be used for is to head to the ‘Gallery of Interesting Jupyter notebooks

Screenshot of data visualisations produced in Jupyter

Jupyter notebooks were originally created as a platform for reproducible research, being able to work with large data sets remotely, record computational analysis (and funky graphs) and then share this with other researchers who could both see your working and validate your results. Very quickly, these were picked up as an excellent educational tool. The ability to create a narrative to guide students through worked examples, giving them the opportunity to interact with code, quickly editing and re-running code and being able to break up your programming into easily defined ‘chunks’ (cells) all helps to lower the barrier to engagement.

It also helps that Jupyter looks remarkably different from a traditional IDE, which can itself act as a barrier to working with code for beginners (I include myself in this bracket: The ‘hackertype’ interface makes me sweat).

The real benefit of Jupyter is realised when using Jupyterhub, which is a multi-user hosted instance. This allows you to set pre-configured workspaces that students can access without the need to install anything beforehand. You can define the programming language that students will use and pre-load packages and libraries to free up class time. Both you and the students are working within a copy of the same environment which makes leading a class of 80 much easier.

Jupyter at the University of Edinburgh

This is what we’ve embraced at the University of Edinburgh: the Noteable service is a version of Jupyterhub with a selection of instances that suit a variety of teaching needs. Instructors create material in Noteable and then share this with their students, knowing that the document will work for them because they are running in an environment with all the associated dependencies and without any prerequisites. This method works incredibly well in a variety of situations: Distance learning where students have a differing setup; lab sessions where you want to work through examples together; or one-off workshop sessions where you want to maximise the time you have available. The medium also lends itself well to creating OER materials or activities like this Christmas example *cough*shameless plug *cough*.

The Noteable service at the University of Edinburgh has been in a pilot phase for the past two academic semesters and will be transitioning to a full service in September 2019 based on its success. Across the year, over 1,000 students have used the service across a variety of courses and the feedback has been great – all the courses will be using it again next academic year. There were already existing pockets of Jupyter users scattered across the University, with some schools managing their own Jupyterhubs or individual academics using Jupyter installed on personal machines. Having a centralised service means that all schools can use Jupyter, not just those fortunate enough to have internal support. This is exemplified by the fact that the students using the service are spread across six different schools including the College of Art, School of Biological Sciences, School of Political Science and of course Informatics (our Computer Science).  

The provision of Jupyter extends outside of the classroom as well. Many students state how they use Noteable to explore other concepts on their own, working on small side-projects or using other available environments to try out something new in another programming language.

The next step in this process is to start making it easier for people to adopt Jupyter into their teaching by creating an extended set of support materials, for both staff and students. So far, we have been able to work with existing Jupyter devotees, but the real growth will come from converting existing courses or helping to provision new courses, where appropriate. All these materials will be openly shared for other institutions to use and to help lower the barrier for adoption in higher education.

The Noteable service itself can also be used by other institutions to further remove barriers to adoption. If you would like to arrange a trial/demo, then get in touch using the contact form.

This leads me on to my final point, something that I can’t help but mention when talking about Jupyter:

Open Source, Open Community

Jupyter is open source, which has certainly helped with its proliferation, but the real driving force has been the community that has built up around Jupyter. There are countless examples of people working on their own projects or collaborating to build Jupyter into something larger: the Zero to Jupyterhub project makes it much easier to set up your own hub, the nbgrader extension allows you to create and grade assignments, RISE allows you to turn your live notebooks into a slidedeck. Project Jupyter has been very active in encouraging all these activities, recently helping to fund a series of community events on various themes, one of which led to the creation of a Teaching and Learning with Jupyter ‘book’ which is a great overview of Jupyter in education.

I could go on but I’m already past an acceptable length for an introductory blog post. We’re keen to be involved in this which is why we will be releasing our help guides and contributing our work back to the community, we also recently hosted a Jupyter Community Workshop event. This was part of the Community Workshop series that was supported by Project Jupyter and funded by Bloomberg, you can read a bit more about this on the Project Jupyter blog.

This workshop had two parts, firstly a hackathon; getting a lot of people together to work on adding functionality to nbgrader but also to highlight the use of Jupyter in education by getting some of the hackathon attendees and awesome local Jupyter gurus to give talks. The hackathon was a great success and the new features are being bundled into the next release of nbgrader. The afternoon of talks was the real party, we were fortunate to have a great line-up of speakers, thankfully you don’t have to miss out as we made sure to record and publish all the talks from the afternoon. You can use view all of the talks on the following open playlist, these talks include a good overview of how Jupyter can be used but also a few tips from the pros to help you make the most of the tools available. 

Jupyter in Education Seminar Series

I’m James Slack, I’m currently a Service Manager for the University of Edinburgh looking after various services including the Noteable service. Before moving to Edinburgh, I was a service manager for the University Sheffield’s Lecture Capture service, so this was quite a side-ways move. For the past year I have been working to introduce the Noteable service to an eager internal audience but am now keen to engage with other Universities using Jupyter to try to promote the platform for use in education. I’m always happy to talk to people about the work myself and the team from EDINA have done and how Jupyter can be used in teaching. Feel free to contact me at james.slack@ed.ac.uk

If you enjoyed reading this article we invite you to join the Association for Learning Technology (ALT) as an individual member, and to encourage your own organisation to join ALT as an organisational or sponsoring member

Leave a Reply

Your email address will not be published. Required fields are marked *