diff --git a/examples/Notebook/Running the Notebook Server.ipynb b/examples/Notebook/Configuring the Notebook and Server.ipynb similarity index 72% rename from examples/Notebook/Running the Notebook Server.ipynb rename to examples/Notebook/Configuring the Notebook and Server.ipynb index ae235d5..f84971d 100644 --- a/examples/Notebook/Running the Notebook Server.ipynb +++ b/examples/Notebook/Configuring the Notebook and Server.ipynb @@ -4,53 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Running the Notebook Server" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The IPython notebook server is a custom web server that runs the notebook web application. Most of the time, users run the notebook server on their local computer using IPython's command line interface." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Starting the notebook server using the command line" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "You can start the notebook server from the command line (Terminal on Mac/Linux, CMD prompt on Windows) by running the following command: \n", - "\n", - " ipython notebook\n", - "\n", - "This will print some information about the notebook server in your terminal, including the URL of the web application (by default, `http://127.0.0.1:8888`). It will then open your default web browser to this URL.\n", - "\n", - "When the notebook opens, you will see the **notebook dashboard**, which will show a list of the notebooks and subdirectories in the directory where the notebook server was started. As of IPython 2.0, the dashboard allows you to navigate to different subdirectories. Because of this, it is no longer necessary to start a separate notebook server for each subdirectory. Most of the time, you will want to start a notebook server in the highest directory in your filesystem where notebooks can be found. Often this will be your home directory.\n", - "\n", - "You can start more than one notebook server at the same time. By default, the first notebook server starts on port 8888 and later notebook servers search for open ports near that one.\n", - "\n", - "You can also specify the port manually:\n", - "\n", - " ipython notebook --port 9999\n", - "\n", - "Or start notebook server without opening a web browser.\n", - "\n", - " ipython notebook --no-browser\n", - "\n", - "The notebook server has a number of other command line arguments that can be displayed with the `--help` flag: \n", - "\n", - " ipython notebook --help\n", - "\n", - "
\n", - "It used to be possible to specify kernel options, such as --pylab inline from the command line. This is deprecated in IPython 2.0 and will be removed in IPython 3.0. To enable matplotlib based plotting for the Python kernel use the %matplotlib magic command.\n", - "
\n", - "\n" + "# Configuring the Notebook and Server" ] }, { @@ -71,19 +25,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "/Users/bgranger/.ipython/profile_default\r\n" - ] - } - ], + "outputs": [], "source": [ "!ipython profile locate default" ] @@ -99,22 +45,11 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_config.py'\r\n", - "[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_qtconsole_config.py'\r\n", - "[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_notebook_config.py'\r\n", - "[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_nbconvert_config.py'\r\n" - ] - } - ], + "outputs": [], "source": [ "!ipython profile create my_profile" ] @@ -128,19 +63,11 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "/Users/bgranger/.ipython/profile_my_profile\r\n" - ] - } - ], + "outputs": [], "source": [ "!ipython profile locate my_profile" ] @@ -194,22 +121,11 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "'sha1:6c2164fc2b22:ed55ecf07fc0f985ab46561483c0e888e8964ae6'" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from IPython.lib import passwd\n", "password = passwd(\"secret\")\n", @@ -371,7 +287,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.4.3" } }, "nbformat": 4, diff --git a/examples/Notebook/Connecting with the Qt Console.ipynb b/examples/Notebook/Connecting with the Qt Console.ipynb index 407f65f..3438889 100644 --- a/examples/Notebook/Connecting with the Qt Console.ipynb +++ b/examples/Notebook/Connecting with the Qt Console.ipynb @@ -54,34 +54,11 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{\n", - " \"stdin_port\": 52858, \n", - " \"ip\": \"127.0.0.1\", \n", - " \"hb_port\": 52859, \n", - " \"key\": \"7efd45ca-d8a2-41b0-9cea-d9116d0fb883\", \n", - " \"shell_port\": 52856, \n", - " \"iopub_port\": 52857\n", - "}\n", - "\n", - "Paste the above JSON into a file, and connect with:\n", - " $> ipython --existing \n", - "or, if you are local, you can connect with just:\n", - " $> ipython --existing kernel-b3bac7c1-8b2c-4536-8082-8d1df24f99ac.json \n", - "or even just:\n", - " $> ipython --existing \n", - "if this is the most recent IPython session you have started.\n" - ] - } - ], + "outputs": [], "source": [ "%connect_info" ] @@ -110,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "collapsed": false }, @@ -121,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "collapsed": false }, @@ -147,7 +124,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.4.3" } }, "nbformat": 4, diff --git a/examples/Notebook/Converting Notebooks With nbconvert.ipynb b/examples/Notebook/Converting Notebooks With nbconvert.ipynb index d12ed17..b06166c 100644 --- a/examples/Notebook/Converting Notebooks With nbconvert.ipynb +++ b/examples/Notebook/Converting Notebooks With nbconvert.ipynb @@ -18,25 +18,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "`NbConvert` is the library, and the command line tool that allow to convert from notebook to other formats.\n", - "It is a technological preview in 1.0 but is already usable and highly configurable.\n", - "It ships already with many default available formats : `html`, `latex`, `markdown`, `python`, `rst` and `slides`\n", - "which are fully base on Jinja templating engine, so writing a converter for your custom format or tweeking the existing \n", - "one should be extra simple." + "`NbConvert` is both a library and command line tool that allows you to convert notebooks to other formats. It ships with many common formats: `html`, `latex`, `markdown`, `python`, `rst`, and `slides`\n", + "NbConvert relys on the Jinja templating engine, so implementing a new format or tweeking an existing one is easy." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "You can invoke nbconvert by doing\n", + "You can invoke nbconvert by running\n", "\n", "```bash\n", "$ ipython nbconvert \n", "```\n", "\n", - "Call `ipython nbconvert` with the `--help` flag or no aruments to get basic help on how to use it.\n", - "For more information about configuration use the `--help-all` flag" + "Call `ipython nbconvert` with the `--help` flag or without any aruments to display the basic help. For detailed configuration help, use the `--help-all` flag." ] }, { @@ -50,230 +46,105 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We will be converting `Custom Display Logic.ipynb`. \n", - "Be sure to have runed some of the cells in it to have output otherwise you will only see input in nbconvert.\n", - "Nbconvert **do not execute the code** in the notebook files, it only converts what is inside." + "As a test, the `Index.ipynb` notebook in the directory will be convert. \n", + "\n", + "If you're converting a notebook with code in it, make sure to run the code cells that you're interested in before attempting to convert the notebook. Nbconvert **does not execute the code cell** of the notebooks that it converts." ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "[NbConvertApp] Using existing profile dir: u'/Users/bussonniermatthias/.ipython/profile_default'\n", - "[NbConvertApp] Converting notebook 04 - Custom Display Logic.ipynb to html\n", - "[NbConvertApp] Support files will be in 04 - Custom Display Logic_files/\n", - "[NbConvertApp] Loaded template html_full.tpl\n", - "[NbConvertApp] Writing 221081 bytes to 04 - Custom Display Logic.html\n" - ] - } - ], + "outputs": [], "source": [ "%%bash\n", - "ipython nbconvert '04 - Custom Display Logic.ipynb'" + "ipython nbconvert 'Index.ipynb'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Html is the default value (that can be configured) , so the verbose form would be " + "Html is the (configurable) default value. The verbose form of the same command as above is " ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "[NbConvertApp] Using existing profile dir: u'/Users/bussonniermatthias/.ipython/profile_default'\n", - "[NbConvertApp] Converting notebook 04 - Custom Display Logic.ipynb to html\n", - "[NbConvertApp] Support files will be in 04 - Custom Display Logic_files/\n", - "[NbConvertApp] Loaded template html_full.tpl\n", - "[NbConvertApp] Writing 221081 bytes to 04 - Custom Display Logic.html\n" - ] - } - ], + "outputs": [], "source": [ "%%bash\n", - "ipython nbconvert --to=html '04 - Custom Display Logic.ipynb'" + "ipython nbconvert --to=html 'Index.ipynb'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "You can also convert to latex, which will take care of extractin the embeded base64 encoded png, or the svg and call inkscape to convert those svg to pdf if necessary :" + "You can also convert to latex, which will extract the embeded images. If the embeded images are SVGs, inkscape is used to convert them to pdf:" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "[NbConvertApp] Using existing profile dir: u'/Users/bussonniermatthias/.ipython/profile_default'\n", - "[NbConvertApp] Converting notebook 04 - Custom Display Logic.ipynb to latex\n", - "[NbConvertApp] Support files will be in 04 - Custom Display Logic_files/\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26432): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26472): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26512): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26552): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26592): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "[NbConvertApp] Loaded template latex_article.tplx\n", - "[NbConvertApp] Writing 41196 bytes to 04 - Custom Display Logic.tex\n" - ] - } - ], + "outputs": [], "source": [ "%%bash\n", - "ipython nbconvert --to=latex '04 - Custom Display Logic.ipynb'" + "ipython nbconvert --to=latex 'Index.ipynb'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "You should just have to compile the generated `.tex` file. If you get the required packages installed, if should compile out of the box.\n", + "Note that the latex conversion creates latex, not a PDF. To create a PDF you need the required third party packages to compile the latex.\n", "\n", - "For convenience we allow to run extra action after the conversion has been done, in particular for `latex` we have a `pdf` post-processor. \n", - "You can define the postprocessor tu run with the `--post` flag." + "A `--post` flag is provided for convinience which allows you to have nbconvert automatically compile a PDF for you from your output." ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "[NbConvertApp] Using existing profile dir: u'/Users/bussonniermatthias/.ipython/profile_default'\n", - "[NbConvertApp] Converting notebook 04 - Custom Display Logic.ipynb to latex\n", - "[NbConvertApp] Support files will be in 04 - Custom Display Logic_files/\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26658): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26698): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26738): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26778): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "Setting Language: .UTF-8\n", - "\n", - "(process:26818): Gtk-WARNING **: Locale not supported by C library.\n", - "\tUsing the fallback 'C' locale.\n", - "[NbConvertApp] Loaded template latex_article.tplx\n", - "[NbConvertApp] Writing 41196 bytes to 04 - Custom Display Logic.tex\n", - "[NbConvertApp] Building PDF: ['pdflatex', '04 - Custom Display Logic.tex']\n" - ] - } - ], + "outputs": [], "source": [ "%%bash\n", - "ipython nbconvert --to=latex '04 - Custom Display Logic.ipynb' --post=pdf" + "ipython nbconvert --to=latex 'Index.ipynb' --post=pdf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Have a look at `04 - Custom Display Logic.pdf`, toward the end, where we compared `display()` vs `display_html()` and returning the object.\n", - "See how the cell where we use `display_html` was not able to display the circle, whereas the two other ones were able to select one of the oher representation they know how to display." + "## Custom templates" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Customizing template" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "let's look at the first 20 lines of the `python` exporter" + "Look at the first 20 lines of the `python` exporter" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "# 1. Implementing special display methods such as `_repr_html_`.\n", - "# 2. Registering a display function for a particular type.\n", - "# \n", - "# In this Notebook we show how both approaches work.\n", - "\n", - "# Before we get started, we will import the various display functions for displaying the different formats we will create.\n", - "\n", - "# In[54]:\n", - "\n", - "from IPython.display import display\n", - "from IPython.display import (\n", - " display_html, display_jpeg, display_png,\n", - " display_javascript, display_svg, display_latex\n", - ")\n", - "\n", - "\n", - "### Implementing special display methods\n", - "\n", - "# The main idea of the first approach is that you have to implement special display methods, one for each representation you want to use. Here is a list of the names of the special methods and the values they must return:\n", - "# \n" - ] - } - ], + "outputs": [], "source": [ - "pyfile = !ipython nbconvert --to python '04 - Custom Display Logic.ipynb' --stdout\n", + "pyfile = !ipython nbconvert --to python 'Index.ipynb' --stdout\n", "for l in pyfile[20:40]:\n", " print l" ] @@ -282,26 +153,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We see that the non-code cell are exported to the file. To have a cleaner script, we will export only the code contained in the code cells.\n", - "\n", - "To do so, we will inherit the python template, and overwrite the markdown blocks to be empty." + "From the code, you can see that non-code cells are also exported. If you want to change this behavior, you can use a custom template. The custom template inherits from the Python template and overwrites the markdown blocks so that they are empty." ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Overwriting simplepython.tpl\n" - ] - } - ], + "outputs": [], "source": [ "%%writefile simplepython.tpl\n", "{% extends 'python.tpl'%}\n", @@ -321,57 +182,13 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "# This was input cell with prompt number : 54\n", - "from IPython.display import display\n", - "from IPython.display import (\n", - " display_html, display_jpeg, display_png,\n", - " display_javascript, display_svg, display_latex\n", - ")\n", - "\n", - "\n", - "# This was input cell with prompt number : 55\n", - "get_ipython().magic(u'load soln/mycircle.py')\n", - "\n", - "\n", - "# This was input cell with prompt number : 56\n", - "class MyCircle(object):\n", - " \n", - " def _repr_html_(self):\n", - " return \"○ (html)\"\n", - "\n", - " def _repr_svg_(self):\n", - " return \"\"\"\n", - " \n", - " \"\"\"\n", - " \n", - " def _repr_latex_(self):\n", - " return r\"$\\bigcirc \\LaTeX$\"\n", - "\n", - " def _repr_javascript_(self):\n", - " return \"alert('I am a circle!');\"\n", - "\n", - "\n", - "# This was input cell with prompt number : 57\n", - "c = MyCircle()\n", - "\n", - "\n", - "# This was input cell with prompt number : 58\n", - "...\n" - ] - } - ], + "outputs": [], "source": [ - "pyfile = !ipython nbconvert --to python '04 - Custom Display Logic.ipynb' --stdout --template=simplepython.tpl\n", + "pyfile = !ipython nbconvert --to python 'Index.ipynb' --stdout --template=simplepython.tpl\n", "\n", "for l in pyfile[4:40]:\n", " print l\n", @@ -382,7 +199,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "I'll let you read Jinja manual for the exact syntax of the template." + "For details about the template syntax, refer to [Jinja's manual](http://jinja.pocoo.org/docs/dev/)." ] }, { @@ -396,22 +213,22 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Notebook fileformat support attaching arbitrary JSON metadata to each cell of a notebook. In this part we will use those metadata." + "The notebook file format supports attaching arbitrary JSON metadata to each cell. Here, as an exercise, you will use the metadata to tags cells." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "First you need to choose another notebook you want to convert to html, and tag some of the cell with metadata.\n", - "You can see the file `soln/celldiff.js` for a solution on how to tag, or follow the javascript tutorial to see how to do that. Use what we have written there to tag cells of some notebooks to `Easy`|`Medium`|`Hard`|``, and convert this notebook using your template." + "First you need to choose another notebook you want to convert to html, and tag some of the cell with metadata. You can refere to the file `soln/celldiff.js` as an example or follow the Javascript tutorial to figure out how do change cell metadata. Assuming you have a notebook with some of the cells tagged as `Easy`|`Medium`|`Hard`|``, the notebook can be converted specially using a custom template. Design your remplate in the cells provided below.\n", + "\n", + "The following, unorganized lines of code, may be of help:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "you might need the following : \n", "```\n", "{% extends 'html_full.tpl'%}\n", "{% block any_cell %}\n", @@ -420,16 +237,16 @@ "
\n", "```\n", "\n", - "`metadata` might not exist, be sure to :\n", + "If your key name under `cell.metadata.example.difficulty`, the following code would get the value of it:\n", "\n", "`cell['metadata'].get('example',{}).get('difficulty','')`\n", "\n", - "tip: use `%%writefile` to edit the template in the notebook :-)" + "Tip: Use `%%writefile` to edit the template in the notebook." ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "collapsed": false }, @@ -472,10 +289,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "As of all of IPython nbconvert can be configured using profiles and passing the `--profile` flag. \n", - "Moreover if a `config.py` file exist in current working directory nbconvert will use that, or read the config file you give to it with the `--config=` flag. \n", - "\n", - "In the end, if you are often running nbconvert on the sam project, `$ ipython nbconvert` should be enough to get you up and ready." + "IPython nbconvert can be configured using the default profile and by selecting a non-default a profile via `--profile` flag. Additionally, if a `config.py` file exist in current working directory, nbconvert will use that as config." ] } ], @@ -495,7 +309,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.4.3" } }, "nbformat": 4, diff --git a/examples/Notebook/Custom Keyboard Shortcuts.ipynb b/examples/Notebook/Custom Keyboard Shortcuts.ipynb index 7162e2b..7d8d6fe 100644 --- a/examples/Notebook/Custom Keyboard Shortcuts.ipynb +++ b/examples/Notebook/Custom Keyboard Shortcuts.ipynb @@ -16,32 +16,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "application/javascript": [ - "\n", - "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', {\n", - " help : 'run cell',\n", - " help_index : 'zz',\n", - " handler : function (event) {\n", - " IPython.notebook.execute_cell();\n", - " return false;\n", - " }}\n", - ");" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "%%javascript\n", "\n", @@ -68,28 +47,11 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "application/javascript": [ - "\n", - "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', function (event) {\n", - " IPython.notebook.execute_cell();\n", - " return false;\n", - "});" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "%%javascript\n", "\n", @@ -108,25 +70,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "application/javascript": [ - "\n", - "IPython.keyboard_manager.command_shortcuts.remove_shortcut('r');" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "%%javascript\n", "\n", @@ -157,7 +105,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.4.3" } }, "nbformat": 4, diff --git a/examples/Notebook/Importing Notebooks.ipynb b/examples/Notebook/Importing Notebooks.ipynb index ed1fe70..7346212 100644 --- a/examples/Notebook/Importing Notebooks.ipynb +++ b/examples/Notebook/Importing Notebooks.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "collapsed": false }, @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "collapsed": false }, @@ -55,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "collapsed": false }, @@ -109,7 +109,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "collapsed": false }, @@ -184,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "collapsed": false }, @@ -226,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "collapsed": false }, @@ -246,19 +246,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "__init__.py mynotebook.ipynb \u001b[34mnbs\u001b[m\u001b[m/\r\n" - ] - } - ], + "outputs": [], "source": [ "ls nbpackage" ] @@ -287,87 +279,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from pygments import highlight\n", "from pygments.lexers import PythonLexer\n", @@ -389,40 +305,11 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/html": [ - "

heading cell

\n", - "
My Notebook
\n", - "

code cell

\n", - "
def foo():\n",
-       "    return "foo"\n",
-       "
\n", - "\n", - "

code cell

\n", - "
def has_ip_syntax():\n",
-       "    listing = !ls\n",
-       "    return listing\n",
-       "
\n", - "\n", - "

code cell

\n", - "
def whatsmyname():\n",
-       "    return __name__\n",
-       "
\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "def show_notebook(fname):\n", " \"\"\"display a short summary of the cells of a notebook\"\"\"\n", @@ -452,19 +339,11 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "importing IPython notebook from nbpackage/mynotebook.ipynb\n" - ] - } - ], + "outputs": [], "source": [ "from nbpackage import mynotebook" ] @@ -478,22 +357,11 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "'foo'" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "mynotebook.foo()" ] @@ -509,29 +377,11 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "['Animations Using clear_output.ipynb',\n", - " 'Connecting with the Qt Console.ipynb',\n", - " 'Importing Notebooks.ipynb',\n", - " 'Progress Bars.ipynb',\n", - " 'Raw Input.ipynb',\n", - " 'SymPy.ipynb',\n", - " 'Trapezoid Rule.ipynb',\n", - " 'nbpackage']" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "mynotebook.has_ip_syntax()" ] @@ -553,19 +403,11 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "__init__.py other.ipynb\r\n" - ] - } - ], + "outputs": [], "source": [ "ls nbpackage/nbs" ] @@ -580,58 +422,22 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/html": [ - "

markdown cell

\n", - "
This notebook just defines `bar`
\n", - "

code cell

\n", - "
def bar(x):\n",
-       "    return "bar" * x\n",
-       "
\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "show_notebook(os.path.join(\"nbpackage\", \"nbs\", \"other.ipynb\"))" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "importing IPython notebook from nbpackage/nbs/other.ipynb\n" - ] - }, - { - "data": { - "text/plain": [ - "'barbarbarbarbar'" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from nbpackage.nbs import other\n", "other.bar(5)" @@ -648,7 +454,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": { "collapsed": false }, @@ -672,29 +478,11 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "importing IPython notebook from /Users/bgranger/Documents/Computing/IPython/code/ipython/IPython/utils/inside_ipython.ipynb\n" - ] - }, - { - "data": { - "text/plain": [ - "'IPython.utils.inside_ipython'" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from IPython.utils import inside_ipython\n", "inside_ipython.whatsmyname()" @@ -725,7 +513,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.4.3" } }, "nbformat": 4, diff --git a/examples/Notebook/Index.ipynb b/examples/Notebook/Index.ipynb index 4a35e51..964b081 100644 --- a/examples/Notebook/Index.ipynb +++ b/examples/Notebook/Index.ipynb @@ -40,13 +40,12 @@ "metadata": {}, "source": [ "* [What is the IPython Notebook](What is the IPython Notebook.ipynb)\n", - "* [Running the Notebook Server](Running the Notebook Server.ipynb)\n", "* [Notebook Basics](Notebook Basics.ipynb)\n", "* [Running Code](Running Code.ipynb)\n", "* [Working With Markdown Cells](Working With Markdown Cells.ipynb)\n", + "* [Configuring the Notebook and Server](Configuring the Notebook and Server.ipynb)\n", "* [Custom Keyboard Shortcuts](Custom Keyboard Shortcuts.ipynb)\n", "* [JavaScript Notebook Extensions](JavaScript Notebook Extensions.ipynb)\n", - "* [Notebook Security](Notebook Security.ipynb)\n", "* [Converting Notebooks With nbconvert](Converting Notebooks With nbconvert.ipynb)\n", "* [Using nbconvert as a Library](Using nbconvert as a Library.ipynb)" ] @@ -84,7 +83,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.4.3" } }, "nbformat": 4, diff --git a/examples/Notebook/JavaScript Notebook Extensions.ipynb b/examples/Notebook/JavaScript Notebook Extensions.ipynb index 9fd02cc..2fe4c8f 100644 --- a/examples/Notebook/JavaScript Notebook Extensions.ipynb +++ b/examples/Notebook/JavaScript Notebook Extensions.ipynb @@ -137,18 +137,7 @@ "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "'/Users/bussonniermatthias/.ipython'" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "profile_dir = ! ipython locate\n", "profile_dir = profile_dir[0]\n", @@ -180,110 +169,7 @@ "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "// we want strict javascript that fails\n", - "// on ambiguous syntax\n", - "\"using strict\";\n", - "\n", - "// notebook loaded is not perfect as it is re-triggerd on\n", - "// revert to checkpoint but this allow extesnsion to be loaded\n", - "// late enough to work.\n", - "$([IPython.events]).on('notebook_loaded.Notebook', function(){\n", - "\n", - "\n", - " /** Use path to js file relative to /static/ dir without leading slash, or\n", - " * js extension.\n", - " * Link directly to file is js extension isa simple file\n", - " *\n", - " * first argument of require is a **list** that can contains several modules if needed.\n", - " **/\n", - "\n", - " //require(['custom/noscroll']);\n", - " // require(['custom/clean_start'])\n", - " // require(['custom/toggle_all_line_number'])\n", - " // require(['custom/gist_it']);\n", - " // require(['custom/autosavetime']);\n", - "\n", - " /**\n", - " * Link to entrypoint if extesnsion is a folder.\n", - " * to be consistent with commonjs module, the entrypoint is main.js\n", - " * here youcan also trigger a custom function on load that will do extra\n", - " * action with the module if needed\n", - " **/\n", - " require(['custom/slidemode/main'])\n", - "\n", - " // require(['custom/autoscroll']);\n", - "\n", - " //require(['custom/css_selector/main'])\n", - " require(['custom/pre_exec_strip']);\n", - " // require(['custom/no_exec_dunder']);\n", - " // load_ext('nbviewer_theme')\n", - "\n", - "\n", - " require(['custom/clippytip/main']);\n", - "\n", - " IPython.toolbar.add_buttons_group([\n", - " {\n", - " 'label' : 'run qtconsole',\n", - " 'icon' : 'icon-paper-clip', // select your icon from http://jqueryui.com/themeroller/\n", - " 'callback': function(){\n", - " IPython.tooltip.remove_and_cancel_tooltip(true)\n", - " $('#tooltip').empty() \n", - " $('#tooltip').attr('style','') \n", - " IPython.tooltip = new IPython.ClippyTip()\n", - " }\n", - " },\n", - " {\n", - " 'label' : 'run qtconsole',\n", - " 'icon' : 'icon-th-large', // select your icon from http://jqueryui.com/themeroller/\n", - " 'callback': function(){\n", - " IPython.tooltip.remove_and_cancel_tooltip(true)\n", - " $('#tooltip').empty() \n", - " $('#tooltip').attr('style','')\n", - " IPython.tooltip = new IPython.Tooltip()\n", - " }\n", - " }\n", - " // add more button here if needed.\n", - " ]);\n", - " //\n", - "\n", - "});\n", - "\n", - "/*\n", - "$([IPython.events]).on('notebook_loaded.Notebook', function(){\n", - " IPython.toolbar.add_buttons_group([\n", - " {\n", - " 'label' : 'run qtconsole',\n", - " 'icon' : 'ui-icon-calculator',\n", - " 'callback': function(){IPython.notebook.kernel.execute('%qtconsole')}\n", - " }\n", - " ]);\n", - "});\n", - "*/\n", - "\n", - "//$([IPython.events]).on('notebook_loaded.Notebook', function(){\n", - "// mobile_preset = []\n", - "// var edit = function(div, cell) {\n", - "// var button_container = $(div);\n", - "// var button = $('
').button({icons:{primary:'ui-icon-pencil'}});\n", - "// button.click(function(){\n", - "// cell.edit()\n", - "// })\n", - "// button_container.append(button);\n", - "// }\n", - "//\n", - "// IPython.CellToolbar.register_callback('mobile.edit',edit);\n", - "// mobile_preset.push('mobile.edit');\n", - "//\n", - "// IPython.CellToolbar.register_preset('Mobile',mobile_preset);\n", - "//});\n" - ] - } - ], + "outputs": [], "source": [ "# my custom js\n", "with open(custom_js_path) as f:\n", @@ -536,44 +422,11 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "application/javascript": [ - "var CellToolbar = IPython.CellToolbar\n", - "var toggle = function(div, cell) {\n", - " var button_container = $(div)\n", - "\n", - " // let's create a button that show the current value of the metadata\n", - " var button = $('