==================================
Using Jupyter Notebook extensions
==================================

You can open Jupyter Notebook by running ``jupyter notebook``, or by opening Anaconda Navigator and clicking the Jupyter Notebook icon.

.. contents::
   :local:
   :depth: 1

With Anaconda you can download and install four extensions for the
Jupyter Notebook that make the notebook easier to use:

* Notebook Present (nbpresent).
* Notebook Anaconda Cloud (nb_anacondacloud).
* Notebook Conda (nb_conda).
* Notebook Conda Kernels (nb_conda_kernels).

Installing any of the four installs all of them. The _nb_ext_conf
package is also installed, which activates the extensions.

Obtaining the extensions
========================

To get the extensions using Anaconda Navigator:

#. Install and manage notebook extensions packages like any other packages. See :doc:`../../navigator/user-guide`.

#. To use the new extensions, on the Navigator **Home** tab, open Jupyter Notebook.

To install all Jupyter Notebook extensions from the command line, run::

    conda install nb_conda

NOTE: These extensions were already installed in Anaconda versions 4.1 and 4.2. If you have Anaconda v4.1 or v4.2 installed, there is no need to install them separately. To begin using them, open a new or existing notebook.

.. _uninstall-extensions:

Uninstalling the extensions
===========================

To remove all Jupyter Notebook extensions, run::

    conda remove nb_conda

Uninstalling ``nb_conda`` or any other one of the four extensions uninstalls all four.

To disable Jupyter Notebook extensions individually without uninstalling them, run::

    python -m nb_conda_kernels.install --disable --prefix=<ENV_PREFIX>

    jupyter-nbextension disable nb_conda --py --sys-prefix
    jupyter-serverextension disable nb_conda --py --sys-prefix

    jupyter-nbextension disable nb_anacondacloud --py --sys-prefix
    jupyter-serverextension disable nb_anacondacloud --py --sys-prefix

    jupyter-nbextension disable nbpresent --py --sys-prefix
    jupyter-serverextension disable nbpresent --py --sys-prefix

NOTE: Replace ``<ENV_PREFIX>`` with your root environment or another conda environment where the extensions have been installed.


.. _notebook-present:

Notebook Present
================

This extension turns your notebook into a PowerPoint-style presentation.

To begin using Notebook Present:

#. In the top menu bar, locate the two buttons Edit Presentation and Show Presentation:

   .. figure:: /img/nb-ext-present1.png

      ..

   |

#. Click the Edit Presentation button. The icon looks like a present in a box with wrapping paper and a bow on top.

   A black bar with several icons appears on the right side of your browser. As you click each icon, the layout of your screen changes:

   .. figure:: /img/nb-ext-present2.png

      ..

   |

#. Click the Help icon to view three quick tours of the main features of Notebook Present:

   * Intro Tour.
   * Slides Tour.
   * Editor Tour.

Intro tour
----------

To see a 2-minute presentation on how to use all of the main features, in the **Help** menu, select Intro.

Every button is explained. You can pause, go back to the previous slide or advance to the next slide. Here is a summary of the presentation:

* App Bar--When Authoring, use the App Bar to control the content and style of your presentation. It also activates several special editing keyboard shortcuts:

  .. figure:: /img/nb-ext-shortcuts.png

  |

* Stop Authoring--Clicking the Edit Presentation button again stops Authoring and removes all keyboard shortcuts.

* Show Presentation--If you just want to run your presentation without using any Authoring tools, click the Show Presentation button.

* Presenting/Authoring--Once you have made some slides, start Presenting, where you can use most Notebook functions with the Theme we have defined, as well as customize slides on the fly.

* Slides button--Slides, which are made of Regions linked to Cell Parts, and can be imported, created, linked, reordered and edited here:

  .. figure:: /img/nb-ext-slides1.png

  |

* Theming--Theming lets you select from existing colors, typography and backgrounds to make distinctive presentations. The first theme you select becomes the default, while you can choose custom themes for a particular slide, such as a title:

  .. figure:: /img/nb-ext-themes.png

  |

* Saving--Whenever you save your Notebook, all your presentation data will be stored in the Notebook .ipynb file.

* Downloading--After you've made a presentation, you can download it as an HTML page. In the menu, select Download, and then select Download As: Presentation (.html).

* Help--Activate Help at any time to try other tours, obtain other information and connect with the Present community.

Slides Tour
-----------

To see a 2-minute presentation on how to create and manage slides, in the **Help** menu, click Slides.

Here is a summary of the presentation:

.. figure:: /img/nb-ext-slides2.png

|

* Slides make up a presentation. Clicking Slides toggles the sorter view and the Slide Toolbar.

* Slide Toolbar--Let's create a new slide. Clicking the + Slide offers some choices for creating your new slide.

* Import--The quickest way to create a presentation is to import every complete cell as a slide. If you've already created slides with the official slideshow cell toolbar or RISE, you can import most of the content.

* Template Library--You can also pick from some existing templates.

* Reuse Slide as Template--You can copy an existing slide.

* Simple Template--A common template is the Quad Chart, with four pieces of content arranged in a grid.

* Region--The Quad Chart has four Regions. Select a region by clicking it.

* Linking a Region to a Cell Part--Each Region can be linked to a single Cell Part.

* Link Overlay--The Link Overlay shows all of the parts available.

* Cell Part: Source (blue)--Source, such as code and Markdown text.

* Cell Part: Outputs (red)--Outputs, such as rich figures and script results.

* Cell Part: Widgets (purple)--Jupyter widgets, which are interactive widgets that provide both visualization and user input.

* Cell Part: Whole (orange)--Finally, a Whole Cell (including its Source, Widgets, and Outputs) can be linked to a single region.

* Part Thumbnail--We'll try to draw a part thumbnail. It can be reliably updated only when a linked Cell Part is displayed when you mouse over it, but you should usually be able to get an idea of what you're seeing. The colors of the regions correspond to the cell types.

* Cell Part: Unlinking--Unlinking removes the connection between a region and a cell part, without deleting either one.

* Region: Trashing--Trashing a Region permanently deletes it, without affecting any linked Cell Part.

* Presenting--Clicking the Present button while editing brings up the Presenter with editing mode still enabled.

* It's still a Notebook--Linked inputs and widgets are still interactive.

* Go forward--Click to go to the next slide.

* Go back--Click to go back to the previous slide.

* Go back to the beginning--Click here to go back to the first slide.

* My work is done here--Click to go back to the Notebook.

Editor Tour
-----------

To see a 2-minute presentation on editing your notebook, in the **Help** menu, click Editor.

Here is a summary of the presentation:

* So You Made Some Slides--Once you've made a few slides, you'll likely need to customize them.

* Editing Slides--Once you have selected a slide, you can activate the Slide Editor by double-clicking the slide or clicking Edit Slide.

* Region Editor--You can click and drag Regions around and resize them.

* Region Tree--You can reorder Regions and see the details of how your Regions show their linked Parts.

* Add Region--You can add new regions.

* Attribute Editor--All of the properties of a region can be edited here.

* Data Layouts--In addition to manually moving regions around, you can use other Layouts, such as a Treemap, which fills the slide.

* More Regions--More regions will be added with a weight of 1.

* Tree Weight--This new value lets you make a Region bigger or smaller based on relative Weight.

* 12 Grid--The Grid is a compromise between Free layout and Treemap layout, and rounds all the values to a factor of 12.

.. _notebook-anaconda-cloud:

Notebook Anaconda Cloud
=======================

You must have an Anaconda Cloud account for this extension
to work. You can sign up for a free account at `Anaconda Cloud <https://anaconda.org/>`_.

#. You can upload your notebook to your Cloud account
   with a simple button push:

   .. figure:: /img/nb-ext-acloud1.png

   |

   You can use the Attach conda environment option described below to embed a
   copy of your conda environment as an ``environment.yaml`` file in the
   notebook metadata.

#. Sign in to Cloud:

   * If you are not signed in to Cloud, a dialog box appears asking for your Cloud user name and password.

   * You may instead log in at the command line::

        anaconda login

   NOTE: This is recommended if you do not have a secure connection.

#. Open Jupyter Notebook, then open the notebook you wish to upload to Cloud.

#. In the top navigation bar, click the Publish to Anaconda Cloud button:

   .. figure:: /img/nb-ext-acloud1.png

   |


#. In the dialog box that appears, select your user name.

#. Type a description of the notebook for display on Cloud:


   .. figure:: /img/nb-ext-acloud4.png

   |

#. If you want the identical environment to be included when the notebook is downloaded and opened, select the Attach conda environment checkbox.

#. Click the Publish button.

#. After publishing, you can view the notebook or play the presentation on Cloud from the top navigation bar by clicking the Cloud button:

   .. figure:: /img/nb-ext-acloud6.png

   |

Your notebook on Anaconda Cloud will look similar to this one:

.. figure:: /img/nb-ext-acloud5.png

|

For more information on Cloud, see :doc:`../../../anaconda-cloud/index`.

.. _notebook-conda:

Notebook Conda
==============

This extension provides conda environment and package access from within Jupyter Notebook.

To manage all environments:

#. While viewing the dashboard file manager, select the **Conda** tab, which shows your current conda environments:

   .. figure:: /img/nb-ext-conda1.png

   |

   NOTE: To add a new conda environment, click the + button
   above the environments list on the right side.

#. Select an environment by clicking its name.

#. In the package management section that displays, the icons from left to right have the following meanings:

   * Search for packages in your current environment.
   * Refresh your packages list.
   * Update selected packages.
   * Remove selected packages.

   .. figure:: /img/nb-ext-conda3.png

   |

To manage the current kernel environment, in the **Kernel** menu, select Conda Packages, which displays a list of Conda Packages in the current environment:

.. figure:: /img/nb-ext-conda2.png

|

For more information on using and managing conda packages, see
`Managing packages <http://conda.pydata.org/docs/using/pkgs.html>`_.

.. _notebook-conda-kernels:

Notebook Conda Kernels
======================

This extension allows you to use conda environment-based kernels from the dashboard and the notebook's **Kernel** menu. It makes the notebook aware of your conda environments, and it is required for Notebook Anaconda Cloud and Notebook Conda.

When creating a new notebook on the **Files** tab, you can pick
any of the Python or R language kernels in any of your environments:

.. figure:: /img/nb-ext-kernel1.png

|

You can also change to those kernels on a current notebook:

.. figure:: /img/nb-ext-kernel2.png

|
