{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# IPython Notebook Basics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Project directory" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* IPython Notebooks are just files (`.ipynb`) on your file system\n", "* The Notebook server is aware of Notebooks in a single directory, which we call the **Notebook directory**\n", "* If you cd to a Notebook directory and type:\n", "\n", " jupyter notebook\n", "\n", " you will see the Notebooks in that directory in the dashboard" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Notebook files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notebook files:\n", "\n", "* Are just that - files (`.ipynb`) on your file system\n", "* Contain JSON data" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import nbformat\n", "\n", "with open('Notebook Basics.ipynb') as f:\n", " nb = nbformat.v4.reads_json(f.read()) " ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[{u'cell_type': u'markdown',\n", " u'metadata': {u'slideshow': {u'slide_type': u'slide'}},\n", " u'source': u'# IPython Notebook Basics'},\n", " {u'cell_type': u'markdown',\n", " u'metadata': {},\n", " u'source': u'## Project directory'},\n", " {u'cell_type': u'markdown',\n", " u'metadata': {},\n", " u'source': u'* IPython Notebooks are just files (`.ipynb`) on your file system\\n* The Notebook server is aware of Notebooks in a single directory, which we call the **Notebook directory**\\n* If you cd to a Notebook directory and type:\\n\\n jupyter notebook\\n\\n you will see the Notebooks in that directory in the dashboard'},\n", " {u'cell_type': u'markdown',\n", " u'metadata': {u'slideshow': {u'slide_type': u'slide'}},\n", " u'source': u'## Notebook files'},\n", " {u'cell_type': u'markdown',\n", " u'metadata': {},\n", " u'source': u'Notebook files:\\n\\n* Are just that - files (`.ipynb`) on your file system\\n* Contain JSON data'}]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nb.cells[0:5]" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "* Embed code, Markdown text, LaTeX equations, images\n", "* Are version control friendly: post your Notebooks on GitHub\n", "* Can be viewed online by anyone at http://nbviewer.org" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "IPython Notebooks can also be exported to `.py` files (see \"File:Download As\" menu item). You can tell the Notebook server to always save these `.py` files alongside the `.ipynb` files by starting the Notebook as:\n", "\n", " ipython notebook --script\n", "\n", "You can import Notebooks from the main Dashboard or simply by copying a Notebook into the Notebook directory." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Overview of the UI" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Dashboard\n", "* Notebook area and cells\n", "* Menu\n", "* Toolbar" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Cell types" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Code\n", "* Markdown\n", "* Raw text" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Keyboard shortcuts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* `Shift-Enter` to run a cell\n", "* `Ctrl-Enter` to run a cell in place\n", "* All other keyboard shortcuts have the form: `Ctrl-m ?`\n", "* Show all keyboard shortcuts using `Ctrl-m h`" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.11" }, "widgets": { "state": {}, "version": "1.1.1" } }, "nbformat": 4, "nbformat_minor": 1 }