Jupyter Notebooks are a perfect fit for scientific work with Python. They combine the following elements:
This allows us to write scientifically meaningful, executable documents that contain results, their interpretation and their provenance. They are a key element for reproducible research.
Jupyter has a so-called rich display system. If Python code returns an object, Jupyter accesses special methods on the object to decide how to display it. This can involve pretty printing, HTML, images, video, sounds etc:
from PIL import Image
from io import BytesIO
import requests
response = requests.get(
"https://ssciwr.github.io/lunch-time-python/lunchtime5/thingstaette.png"
)
img = Image.open(BytesIO(response.content))
?img._repr_png_
img