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 2022, the University of Bath is continuing to pilot 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:
- Share a Jupyter Notebook with instructional materials and exercises to support students learning to code. [Example link: ARC Lessons - Introduction to Programming in Python]
- Jupyter Notebook simulations to allow students to explore a problem: a coding to learn approach.
- Jupyter Notebooks as a lab book of data analysis, which includes code, results and discussion. This could support student project work or research as a supplement for a lab report. [Example link: student project - The Bayesian Astrometric Dust Cartogropher]
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 .
What are the pros & cons?
- 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).
- 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).
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 )
- Teaching and Learning with Jupyter (2019) web
- Shen, H. (2014) Interactive notebooks: Sharing the code (Nature Article)
- Perkel, J. (2018) Why Jupyter is data scientists’ computational notebook of choice (Nature Article)