Jupyter notebooks are an interface to a programming language, surrounded by a rich environment for documenting, visualizing, and writing.
When you open or create a notebook, you are actually starting two things:
The backend kernel can be in any number of programming languages, including Python 2, Python 3, or Scheme. Initially, the backend will start in Python 2, but you can change that after you create the notebook. After you create a new notebook, you will be in the notebook editor frontend (see below). In the upper right-hand corner, simply change the pull-down list from
IPython (Python 2) to
This server is running on a Linux computer. You can also talk directly to this computer by using "shell magics" discussed below.
The Jupyter Project at Bryn Mawr College will use the web interface. This allows you to edit, document, and execute code in a web browser.
Using Jupyter, you'll be able to execute code in many computer languages. By default, a newly created notebook will use "IPython (Python 2)". You can also install other computer languages. Once you change a notebook's associated language, it will remember your choice, and attempt to startup that language.
Code is executed by a "kernel". We will refer to a language as a kernel in much of the Jupyter documentation.
Jupyter uses the word "magic" to refer to "meta commands". These meta commands are largely independent of the particular kernel you are using. However, the magics for each kernel may differ.
Below we show some command magics.
In a Jupyter notebook, you can talk directly to the computer through an operating system shell. To list out the files in the current directy, us the
! ls -l
total 188 -rw-r--r-- 1 dblank dblank 3111 Aug 31 14:51 00 Jupyter Notebooks.ipynb -rw-r--r-- 1 dblank dblank 18385 Aug 27 06:20 01 Scheme, Introduction.ipynb drwxrwxr-x 2 dblank dblank 4096 Aug 29 12:54 images -rw-r--r-- 1 dblank dblank 17195 Aug 30 10:13 Jupyter Help.ipynb -rw-r--r-- 1 dblank dblank 3015 Aug 29 15:57 Jupyter Magics.ipynb -rw-r--r-- 1 dblank dblank 92667 Aug 29 13:02 Jupyter Notebook Users Manual.ipynb -rw-r--r-- 1 dblank dblank 39037 Aug 29 20:42 Jupyter Visualizations.ipynb -rw-r--r-- 1 dblank dblank 2960 Aug 29 20:36 timeline.html
pwd to "print working direct":
You can usually put a question mark before or after an item's name and execute the shell. Usually, one question mark means "give me a hint about what this is"; two question marks mean "give me more details". You can also press SHIFT+TAB after a word in an expression and see the hint. In these examples, we are using the Calico Scheme kernel:
Press SHIFT+TAB with the cursor after the last e in "define":
Magic commands start out with either a "!", "?", or "%":