Show More
@@ -149,7 +149,7 b' At certain moments, it may be necessary to interrupt a particularly long calcula' | |||||
149 | After a restart, all relevant cells must be re-evaluated |
|
149 | After a restart, all relevant cells must be re-evaluated | |
150 |
|
150 | |||
151 |
|
151 | |||
152 |
A notebook may be downloaded in either ``.ipynb`` or raw ``.py`` form from the menu option ``File |
|
152 | A notebook may be downloaded in either ``.ipynb`` or raw ``.py`` form from the menu option ``File | Download as`` | |
153 | Choosing the ``.py`` option removes all output and saves the text cells |
|
153 | Choosing the ``.py`` option removes all output and saves the text cells | |
154 | in comment areas. See ref:`below <notebook_format>` for more details on the |
|
154 | in comment areas. See ref:`below <notebook_format>` for more details on the | |
155 | notebook format. |
|
155 | notebook format. | |
@@ -174,7 +174,7 b' All actions in the notebook can be achieved with the mouse, but' | |||||
174 | keyboard shortcuts are also available for the most common ones, so that productive use of the notebook can be achieved with minimal mouse usage. The main shortcuts to remember are the following: |
|
174 | keyboard shortcuts are also available for the most common ones, so that productive use of the notebook can be achieved with minimal mouse usage. The main shortcuts to remember are the following: | |
175 |
|
175 | |||
176 | * :kbd:`Shift-Enter`: |
|
176 | * :kbd:`Shift-Enter`: | |
177 |
Execute the current cell, show output (if any), and jump to the next cell below. If :kbd:`Shift-Enter` is invoked on the last input cell, a new code cell will also be created. Note that in the notebook, typing :kbd:`Enter` on its own *never* forces execution, but rather just inserts a new line in the current input cell. In the Notebook it is thus always necessary to use :kbd:`Shift-Enter` to execute the cell (or use the ``Cell |
|
177 | Execute the current cell, show output (if any), and jump to the next cell below. If :kbd:`Shift-Enter` is invoked on the last input cell, a new code cell will also be created. Note that in the notebook, typing :kbd:`Enter` on its own *never* forces execution, but rather just inserts a new line in the current input cell. In the Notebook it is thus always necessary to use :kbd:`Shift-Enter` to execute the cell (or use the ``Cell | Run`` menu item). | |
178 |
|
178 | |||
179 | * :kbd:`Ctrl-Enter`: |
|
179 | * :kbd:`Ctrl-Enter`: | |
180 | Execute the current cell as if it were in "terminal mode", where any output is shown, but the cursor *remains* in the current cell. This is convenient for doing quick experiments in place, or for querying things like filesystem content, without needing to create additional cells that you may not want to be saved in the notebook. |
|
180 | Execute the current cell as if it were in "terminal mode", where any output is shown, but the cursor *remains* in the current cell. This is convenient for doing quick experiments in place, or for querying things like filesystem content, without needing to create additional cells that you may not want to be saved in the notebook. | |
@@ -528,7 +528,7 b' file information as well as the content of the JSON data structure it contains.' | |||||
528 | Running a public notebook server |
|
528 | Running a public notebook server | |
529 | -------------------------------- |
|
529 | -------------------------------- | |
530 |
|
530 | |||
531 |
If you want to access your notebook server remotely |
|
531 | If you want to access your notebook server remotely via a web browser, | |
532 | you can do the following. |
|
532 | you can do the following. | |
533 |
|
533 | |||
534 | Start by creating a certificate file and a hashed password, as explained above. Then, create a custom profile for the notebook: at the command line, type:: |
|
534 | Start by creating a certificate file and a hashed password, as explained above. Then, create a custom profile for the notebook: at the command line, type:: | |
@@ -556,12 +556,12 b' You can then start the notebook and access it later by pointing your browser to' | |||||
556 | Running with a different URL prefix |
|
556 | Running with a different URL prefix | |
557 | ----------------------------------- |
|
557 | ----------------------------------- | |
558 |
|
558 | |||
559 |
The notebook dashboard ( |
|
559 | The notebook dashboard (the landing page with an overview | |
560 |
of |
|
560 | of the notebooks in your working directory) typically lives at the URL | |
561 |
|
|
561 | ``http://localhost:8888/``. If you want to have it, and the rest of the | |
562 | notebook, live under a sub-directory, |
|
562 | notebook, live under a sub-directory, | |
563 |
e.g. |
|
563 | e.g. ``http://localhost:8888/ipython/``d, you can do so with | |
564 |
configuration options like the |
|
564 | configuration options like the following (see above for instructions about | |
565 |
|
|
565 | modifying ``ipython_notebook_config.py``):: | |
566 |
|
566 | |||
567 | c.NotebookApp.base_project_url = '/ipython/' |
|
567 | c.NotebookApp.base_project_url = '/ipython/' | |
@@ -571,13 +571,10 b' modifying ``ipython_notebook_config.py``)::' | |||||
571 | Using a different notebook store |
|
571 | Using a different notebook store | |
572 | -------------------------------- |
|
572 | -------------------------------- | |
573 |
|
573 | |||
574 | By default the notebook server stores notebooks as files in the working |
|
574 | By default, the Notebook app stores the notebook documents that it saves as files in the working directory of the Notebook app, also known as the ``notebook_dir``. This logic is implemented in the :class:`FileNotebookManager` class. However, the server can be configured to use a different notebook manager class, which can | |
575 | directory of the notebook server, also known as the ``notebook_dir``. This |
|
575 | store the notebooks in a different format. | |
576 | logic is implemented in the :class:`FileNotebookManager` class. However, the |
|
576 | ||
577 | server can be configured to use a different notebook manager class, which can |
|
577 | Currently, we ship a :class:`AzureNotebookManager` class that stores notebooks in Azure blob storage. This can be used by adding the following lines to your | |
578 | store the notebooks in a different format. Currently, we ship a |
|
|||
579 | :class:`AzureNotebookManager` class that stores notebooks in Azure blob |
|
|||
580 | storage. This can be used by adding the following lines to your |
|
|||
581 | ``ipython_notebook_config.py`` file:: |
|
578 | ``ipython_notebook_config.py`` file:: | |
582 |
|
579 | |||
583 | c.NotebookApp.notebook_manager_class = 'IPython.html.services.notebooks.azurenbmanager.AzureNotebookManager' |
|
580 | c.NotebookApp.notebook_manager_class = 'IPython.html.services.notebooks.azurenbmanager.AzureNotebookManager' | |
@@ -587,14 +584,13 b' storage. This can be used by adding the following lines to your' | |||||
587 |
|
584 | |||
588 | In addition to providing your Azure Blob Storage account name and key, you will |
|
585 | In addition to providing your Azure Blob Storage account name and key, you will | |
589 | have to provide a container name; you can use multiple containers to organize |
|
586 | have to provide a container name; you can use multiple containers to organize | |
590 |
your |
|
587 | your notebooks. | |
591 |
|
588 | |||
592 | .. _notebook_format: |
|
589 | .. _notebook_format: | |
593 |
|
590 | |||
594 | Notebook JSON format |
|
591 | JSON format of notebook document files | |
595 | ==================== |
|
592 | -------------------------------------- | |
596 |
|
593 | Notebook documents are JSON files with an ``.ipynb`` extension, formatted | ||
597 | Notebooks are JSON files with an ``.ipynb`` extension, formatted |
|
|||
598 | as legibly as possible with minimal extra indentation and cell content broken |
|
594 | as legibly as possible with minimal extra indentation and cell content broken | |
599 | across lines to make them reasonably friendly to use in version-control |
|
595 | across lines to make them reasonably friendly to use in version-control | |
600 | workflows. You should be very careful if you ever manually edit this JSON |
|
596 | workflows. You should be very careful if you ever manually edit this JSON | |
@@ -604,41 +600,78 b' file meant only to be edited by the IPython Notebook app itself, not for hand-ed' | |||||
604 |
|
600 | |||
605 | .. note:: |
|
601 | .. note:: | |
606 |
|
602 | |||
607 | Binary data such as figures are directly saved in the JSON file. This |
|
603 | Binary data such as figures are also saved directly in the JSON file. This provides convenient single-file portability, but means that the files can be large; ``diff``s of binary data also are not very meaningful. Since the binary blobs are encoded in a single line, they affect only one line of the ``diff`` output, but they are typically very long lines. You can use the ``Cell | All Output | Clear`` menu option to remove all output from a notebook prior to committing it to version control, if this is a concdern. | |
608 | provides convenient single-file portability, but means that the files can |
|
|||
609 | be large; ``diff``s of binary data also are not very meaningful. Since the |
|
|||
610 | binary blobs are encoded in a single line, they affect only one line of |
|
|||
611 | the ``diff`` output, but they are typically very long lines. You can use the ``Cell -> All Output -> Clear`` menu option to remove all output from a notebook prior to committing it to version control, if this is a concern. |
|
|||
612 |
|
604 | |||
613 | The notebook server can also generate a pure Python version of your notebook, |
|
605 | The notebook server can also generate a pure Python version of your notebook, | |
614 |
using the ``File |
|
606 | using the ``File | Download as`` menu option. The resulting ``.py`` file will | |
615 | contain all the code cells from your notebook verbatim, and all text cells |
|
607 | contain all the code cells from your notebook verbatim, and all text cells | |
616 | prepended with a comment marker. The separation between code and text |
|
608 | prepended with a comment marker. The separation between code and text | |
617 | cells is indicated with special comments and there is a header indicating the |
|
609 | cells is indicated with special comments and there is a header indicating the | |
618 |
format version. All output is |
|
610 | format version. All output is removed when exporting to Python. | |
619 |
|
611 | |||
620 | Here is an example of the Python output from a simple notebook with one text cell and one code input cell:: |
|
612 | As an example, consider a simple notebook called ``simple.ipynb`` which contains one Markdown cell, with the content ``The simplest notebook.``, one code input cell with the content ``print Hello, IPython!``, and the corresopnding output. | |
621 |
|
613 | |||
622 | # <nbformat>2</nbformat> |
|
614 | The contents of ``simple.ipynb`` is the following JSON container:: | |
623 |
|
|
615 | ||
624 | # <markdowncell> |
|
616 | { | |
625 |
|
617 | "metadata": { | ||
626 | # A text cell |
|
618 | "name": "simple" | |
627 |
|
619 | }, | ||
628 | # <codecell> |
|
620 | "nbformat": 3, | |
629 |
|
621 | "nbformat_minor": 0, | ||
630 | print "Hello, IPython!" |
|
622 | "worksheets": [ | |
|
623 | { | |||
|
624 | "cells": [ | |||
|
625 | { | |||
|
626 | "cell_type": "markdown", | |||
|
627 | "metadata": {}, | |||
|
628 | "source": "The simplest notebook." | |||
|
629 | }, | |||
|
630 | { | |||
|
631 | "cell_type": "code", | |||
|
632 | "collapsed": false, | |||
|
633 | "input": "print \"Hello, IPython\"", | |||
|
634 | "language": "python", | |||
|
635 | "metadata": {}, | |||
|
636 | "outputs": [ | |||
|
637 | { | |||
|
638 | "output_type": "stream", | |||
|
639 | "stream": "stdout", | |||
|
640 | "text": "Hello, IPython\n" | |||
|
641 | } | |||
|
642 | ], | |||
|
643 | "prompt_number": 1 | |||
|
644 | } | |||
|
645 | ], | |||
|
646 | "metadata": {} | |||
|
647 | } | |||
|
648 | ] | |||
|
649 | } | |||
|
650 | ||||
|
651 | ||||
|
652 | The corresponding Python script is:: | |||
|
653 | ||||
|
654 | # -*- coding: utf-8 -*- | |||
|
655 | # <nbformat>3.0</nbformat> | |||
|
656 | ||||
|
657 | # <markdowncell> | |||
|
658 | ||||
|
659 | # The simplest notebook. | |||
|
660 | ||||
|
661 | # <codecell> | |||
|
662 | ||||
|
663 | print "Hello, IPython" | |||
631 |
|
664 | |||
632 |
|
665 | |||
633 | Known issues |
|
666 | Known issues | |
634 | ============ |
|
667 | ------------ | |
635 |
|
668 | |||
636 | When behind a proxy, especially if your system or browser is set to autodetect |
|
669 | When behind a proxy, especially if your system or browser is set to autodetect | |
637 | the proxy, the Notebook app might fail to connect to the server's websockets, |
|
670 | the proxy, the Notebook app might fail to connect to the server's websockets, | |
638 | and present you with a warning at startup. In this case, you need to configure |
|
671 | and present you with a warning at startup. In this case, you need to configure | |
639 | your system not to use the proxy for the server's address. |
|
672 | your system not to use the proxy for the server's address. | |
640 |
|
673 | |||
641 |
|
|
674 | For example, in Firefox, go to the Preferences panel, Advanced section, | |
642 | Network tab, click 'Settings...', and add the address of the notebook server |
|
675 | Network tab, click 'Settings...', and add the address of the notebook server | |
643 | to the 'No proxy for' field. |
|
676 | to the 'No proxy for' field. | |
644 |
|
677 |
General Comments 0
You need to be logged in to leave comments.
Login now