What is it?

Jupyter notebooks are human read-able documents that have descriptive content (text, images), executable code (e.g. Python, R) and the results (e.g. figures, interactive widgets) in a single place.

Jupyter notebooks run in browser and connect to a server: this could be on a local machine for offline use or via a hosted service (Update May 2021, the University of Bath is exploring having a cloud based Jupyter notebook service). The Jupyter instance can be configured to support different libraries to allow students to start coding straight away, and allows for easy sharing of information, code and output between staff and students.

How might I use it?

Jupyter notebooks can be used to communicate and share materials learning and teaching, as well as research outputs. For example:

How can staff and students use it effectively?

  • Use natural language to explain program logic to create learning materials based on a Literate Programming approach [Knuth 1984, Ramsey 1994].
  • Communicate the code/data methods and analysis workflow.
  • Embed coding in the curriculum: students run simulations to support understanding of coding and also subject context (e.g. live in lecture).
  • Use it as a workspace for prototyping code or exploring data.
  • Use nbfancy to enhance the appearance of Jupyter Notebook lessons.
  • Use an existing range of pedagogical best practices to create different activities to challenge and engage students. For a really good guide to different practices see Catalogue of Pedagogical Patterns in Teaching and Learning with Jupyter [2019].

What are the pros & cons?

Pros
  • Supports a Literate Programming Approach: comments allow for rich explanation (including images, diagrams) to support student understanding.
  • Markdown allows clear and digitally accessible documents to be produced easily that can mix executable code, text and equations.
  • Code blocks support short iteration cycles and debugging.
  • Supports open analysis and reproducibility: output of figures is in-line with code rather than as separate files, which allows clearer communication of process and results.
  • As a web-hosted service
    • "Plug-and-play" for students to focus on programming: there is no install barrier or conflicting dependencies for students to manage and it is platform/hardware agnostic (only needs a browser to run).
    • Allows for lecture rooms to becomes computer labs (students bring own devices).
Cons
  • Code blocks can be executed in any order so the state of a notebook is not always clear (5 reasons why jupyter notebooks suck)
  • Jupyter Notebooks are not the best platform for all applications (e.g. larger programs).
  • Code versioning and tracking changes is hard to achieve (Notebooks state is saved in large JSON file).

Case studies

Coding to Teach: Notebooks and Python in Kinetic Lectures - Ben Morgan (Chemistry)

To support understanding of reaction kinetics and the associated analytical solutions, an interactive model was run in Jupyter Notebooks to find numerical solutions. Students were able to approach the problem from a different angle to learn about the rates, whilst also exposing them to computational thinking. Python in Chemistry - introducing Python to Chemistry Students

Large cohort implementation at UC Berkeley

The introductory course, Foundations in Data Science, at the University of California at Berkeley's runs entirely with Jupyter Notebook and teaches 1400 students. This scale and rapid growth of the course was made possible because Jupyter allowed "browser-based computation, avoiding the need for students to install software, transfer files, or update libraries" (The course of the future – and the technology behind it [2017])

Further reading

References

Themes

  • Online learning
  • Course wide learning
  • Engage with research
  • Learning Resources

Guidance

Teaching and Learning with Jupyter (ebook)

Jupyter Notebook for Beginners: A Tutorial

Jupyter Documentation

Copyright information

Bath Baseline

UK Professional Skills Framework

Contacts

For advice on using Jupyter Notebooks to enhance learning, teaching and assessment contact the TEL team: tel@bath.ac.uk