About Jupyter Notebooks
What is the Jupyter Notebook (provided by official documentation)
Introduction
The Jupyter Notebook is an interactive computing environment that enables users to author notebook documents that include:
Live code
Interactive widgets
Plots
Narrative text
Equations
Images
Video
These documents provide a complete and self-contained record of a computation that can be converted to various formats and shared with others using email, Dropbox, version control systems (like git/GitHub) or nbviewer.jupyter.org.
Components
The Jupyter Notebook combines three components:
The notebook web application: An interactive web application for writing and running code interactively and authoring notebook documents.
Kernels: Separate processes started by the notebook web application that runs users' code in a given language and returns output back to the notebook web application. The kernel also handles things like computations for interactive widgets, tab completion and introspection.
Notebook documents: Self-contained documents that contain a representation of all content visible in the notebook web application, including inputs and outputs of the computations, narrative text, equations, images, and rich media representations of objects. Each notebook document has its own kernel.
Notebook web application
The notebook web application enables users to:
Edit code in the browser, with automatic syntax highlighting, indentation, and tab completion/introspection.
Run code from the browser, with the results of computations attached to the code which generated them.
See the results of computations with rich media representations, such as HTML, LaTeX, PNG, SVG, PDF, etc.
Create and use interactive JavaScript widgets, which bind interactive user interface controls and visualizations to reactive kernel side computations.
Author narrative text using the Markdown markup language.
Include mathematical equations using LaTeX syntax in Markdown, which are rendered in-browser by MathJax.
Kernels
Through Jupyter's kernel and messaging architecture, the Notebook allows code to be run in a range of different programming languages. For each notebook document that a user opens, the web application starts a kernel that runs the code for that notebook. Each kernel is capable of running code in a single programming language and there are kernels available in the following languages:
Haskell (https://github.com/gibiansky/IHaskell)
node.js (https://gist.github.com/Carreau/4279371)
The default kernel runs Python code. The notebook provides a simple way for users to pick which of these kernels is used for a given notebook.
Each of these kernels communicate with the notebook web application and web browser using a JSON over ZeroMQ/WebSockets message protocol that is described here. Most users don't need to know about these details, but it helps to understand that "kernels run code."
Notebook documents
Notebook documents contain the inputs and outputs of an interactive session as well as narrative text that accompanies the code but is not meant for execution. Rich output generated by running code, including HTML, images, video, and plots, is embedded in the notebook, which makes it a complete and self-contained record of a computation.
When you run the notebook web application on your computer, notebook documents are just files on your local filesystem with a .ipynb
extension. This allows you to use familiar workflows for organizing your notebooks into folders and sharing them with others.
Notebooks consist of a linear sequence of cells. There are four basic cell types:
Code cells: Input and output of live code that is run in the kernel
Markdown cells: Narrative text with embedded LaTeX equations
Heading cells: 6 levels of hierarchical organization and formatting
Raw cells: Unformatted text that is included, without modification, when notebooks are converted to different formats using nbconvert
Internally, notebook documents are JSON data with binary values base64 encoded. This allows them to be read and manipulated programmatically by any programming language. Because JSON is a text format, notebook documents are version control friendly.
Notebooks can be exported to different static formats including HTML, reStructeredText, LaTeX, PDF, and slide shows (reveal.js) using Jupyter's nbconvert
utility.
Furthermore, any notebook document available from a public URL on or GitHub can be shared via nbviewer. This service loads the notebook document from the URL and renders it as a static web page. The resulting web page may thus be shared with others without their needing to install the Jupyter Notebook.
Last updated