##// END OF EJS Templates
Finished first pass of refactoring
David P. Sanders -
Show More
@@ -288,11 +288,11 b' Converting notebooks to other formats'
288 -------------------------------------
288 -------------------------------------
289 Newly added in the 1.0 release of IPython is the ``nbconvert`` tool to convert a notebook document into another static format. This is a command line tool; at present, this functionality is not available to export directly from within the Notebook app. The syntax is::
289 Newly added in the 1.0 release of IPython is the ``nbconvert`` tool to convert a notebook document into another static format. This is a command line tool; at present, this functionality is not available to export directly from within the Notebook app. The syntax is::
290
290
291 ``$ ipython nbconvert notebook.ipynb``
291 $ ipython nbconvert notebook.ipynb
292
292
293 for standard HTML output, or::
293 for standard HTML output, or::
294
294
295 ``$ ipython nbconvert --format=FORMAT notebook.ipynb``
295 $ ipython nbconvert --format=FORMAT notebook.ipynb
296
296
297 where ``FORMAT`` is the desired export format. Options for this format include:
297 where ``FORMAT`` is the desired export format. Options for this format include:
298
298
@@ -331,9 +331,8 b' To create a new set of default configuration files, with lots of information on '
331 :ref:`config_overview`, in particular :ref:`Profiles`.
331 :ref:`config_overview`, in particular :ref:`Profiles`.
332
332
333
333
334
334 Extracting standard Python files from notebooks
335 Importing or executing a notebook as a normal Python file
335 -----------------------------------------------
336 ---------------------------------------------------------
337
336
338 The native format of the notebook, a file with a ``.ipynb`` `extension, is a
337 The native format of the notebook, a file with a ``.ipynb`` `extension, is a
339 JSON container of all the input and output of the notebook, and therefore not
338 JSON container of all the input and output of the notebook, and therefore not
@@ -377,9 +376,9 b' and then on any cell that you need to protect, use::'
377 .. _notebook_security:
376 .. _notebook_security:
378
377
379 Security
378 Security
380 ========
379 --------
381
380
382 You can protect your notebook server with a simple single-password by
381 You can protect your Notebook server with a simple singlepassword by
383 setting the :attr:`NotebookApp.password` configurable. You can prepare a
382 setting the :attr:`NotebookApp.password` configurable. You can prepare a
384 hashed password using the function :func:`IPython.lib.security.passwd`:
383 hashed password using the function :func:`IPython.lib.security.passwd`:
385
384
@@ -404,16 +403,13 b' You can then add this to your :file:`ipython_notebook_config.py`, e.g.::'
404
403
405 When using a password, it is a good idea to also use SSL, so that your password
404 When using a password, it is a good idea to also use SSL, so that your password
406 is not sent unencrypted by your browser. You can start the notebook to
405 is not sent unencrypted by your browser. You can start the notebook to
407 communicate via a secure protocol mode using a self-signed certificate by
406 communicate via a secure protocol mode using a self-signed certificate with the command::
408 typing::
409
407
410 $ ipython notebook --certfile=mycert.pem
408 $ ipython notebook --certfile=mycert.pem
411
409
412 .. note::
410 .. note::
413
411
414 A self-signed certificate can be generated with openssl. For example, the
412 A self-signed certificate can be generated with ``openssl``. For example, the following command will create a certificate valid for 365 days with both the key and certificate data written to the same file::
415 following command will create a certificate valid for 365 days with both
416 the key and certificate data written to the same file::
417
413
418 $ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
414 $ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
419
415
@@ -429,8 +425,6 b' notebook server over ``https://``, not over plain ``http://``. The startup'
429 message from the server prints this, but it's easy to overlook and think the
425 message from the server prints this, but it's easy to overlook and think the
430 server is for some reason non-responsive.
426 server is for some reason non-responsive.
431
427
432 Quick how to's
433 ==============
434
428
435 Connecting to an existing kernel
429 Connecting to an existing kernel
436 ---------------------------------
430 ---------------------------------
@@ -525,36 +519,33 b' your Notebooks.'
525
519
526 .. _notebook_format:
520 .. _notebook_format:
527
521
528 The notebook format
522 Notebook JSON format
529 ===================
523 ====================
530
524
531 The notebooks themselves are JSON files with an ``ipynb`` extension, formatted
525 Notebooks are JSON files with an ``.ipynb`` extension, formatted
532 as legibly as possible with minimal extra indentation and cell content broken
526 as legibly as possible with minimal extra indentation and cell content broken
533 across lines to make them reasonably friendly to use in version-control
527 across lines to make them reasonably friendly to use in version-control
534 workflows. You should be very careful if you ever edit manually this JSON
528 workflows. You should be very careful if you ever manually edit this JSON
535 data, as it is extremely easy to corrupt its internal structure and make the
529 data, as it is extremely easy to corrupt its internal structure and make the
536 file impossible to load. In general, you should consider the notebook as a
530 file impossible to load. In general, you should consider the notebook as a
537 file meant only to be edited by IPython itself, not for hand-editing.
531 file meant only to be edited by the IPython Notebook app itself, not for hand-editing.
538
532
539 .. note::
533 .. note::
540
534
541 Binary data such as figures are directly saved in the JSON file. This
535 Binary data such as figures are directly saved in the JSON file. This
542 provides convenient single-file portability but means the files can be
536 provides convenient single-file portability, but means that the files can
543 large and diffs of binary data aren't very meaningful. Since the binary
537 be large; ``diff``s of binary data also are not very meaningful. Since the
544 blobs are encoded in a single line they only affect one line of the diff
538 binary blobs are encoded in a single line, they affect only one line of
545 output, but they are typically very long lines. You can use the
539 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.
546 'ClearAll' button to remove all output from a notebook prior to
540
547 committing it to version control, if this is a concern.
541 The notebook server can also generate a pure Python version of your notebook,
548
542 using the ``File -> Download as`` menu option. The resulting ``.py`` file will
549 The notebook server can also generate a pure-python version of your notebook,
543 contain all the code cells from your notebook verbatim, and all text cells
550 by clicking on the 'Download' button and selecting ``py`` as the format. This
544 prepended with a comment marker. The separation between code and text
551 file will contain all the code cells from your notebook verbatim, and all text
552 cells prepended with a comment marker. The separation between code and text
553 cells is indicated with special comments and there is a header indicating the
545 cells is indicated with special comments and there is a header indicating the
554 format version. All output is stripped out when exporting to python.
546 format version. All output is stripped out when exporting to Python.
555
547
556 Here is an example of a simple notebook with one text cell and one code input
548 Here is an example of the Python output from a simple notebook with one text cell and one code input cell::
557 cell, when exported to python format::
558
549
559 # <nbformat>2</nbformat>
550 # <nbformat>2</nbformat>
560
551
@@ -564,14 +555,14 b' cell, when exported to python format::'
564
555
565 # <codecell>
556 # <codecell>
566
557
567 print "hello IPython"
558 print "Hello, IPython!"
568
559
569
560
570 Known issues
561 Known issues
571 ============
562 ============
572
563
573 When behind a proxy, especially if your system or browser is set to autodetect
564 When behind a proxy, especially if your system or browser is set to autodetect
574 the proxy, the html notebook might fail to connect to the server's websockets,
565 the proxy, the Notebook app might fail to connect to the server's websockets,
575 and present you with a warning at startup. In this case, you need to configure
566 and present you with a warning at startup. In this case, you need to configure
576 your system not to use the proxy for the server's address.
567 your system not to use the proxy for the server's address.
577
568
General Comments 0
You need to be logged in to leave comments. Login now