===========================
Jupyter Notebook Extensions
===========================

Included with Anaconda distribution 4.1 are several new extensions 
for the Jupyter Notebook that make the notebook easier to use.

Summary of extensions
=====================

* :ref:`Notebook Present <notebook-present>`: Turn your notebooks into powerful 
  PowerPoint-style presentations. 
* :ref:`Notebook Anaconda Cloud <notebook-anaconda-cloud>`: Upload your notebook and 
  optionally, its conda environment, to your Anaconda Cloud account with the push of a button.
* :ref:`Notebook Conda <notebook-conda>`: Provides Conda environment and package access 
  from within Jupyter Notebook.
* :ref:`Notebook Conda Kernels <notebook-conda-kernels>`: Use conda environment-based 
  kernels from dashboard and the notebook's Kernel menu

How to get the extensions
=========================

To get the Jupyter Notebook Extensions, you can do any of the following:

Anaconda Navigator
------------------

If you are an Anaconda Navigator user, Navigator checks for updates 
each time you open it. Simply open Navigator and answer "yes" when 
it asks you if you want to update. Extensions are automatically 
installed when you update Navigator. Then from your Navigator  
Home tab, open your Jupyter Notebook to see the new extensions. 

Command line
------------

Update Anaconda to get and install all of the new extensions at 
one time::

  conda update anaconda

Or you may download only the individual extensions that you choose:

**Notebook Present** (nbpresent) ``conda install nbpresent``

**Notebook Anaconda Cloud** (nb_anacondacloud) ``conda install nb_anacondacloud``

**Notebook Conda** (nb_conda)* ``conda install nb_conda``

**Notebook Conda Kernels** (nb_conda_kernels)* ``conda install nb_conda_kernels``

*NOTE: By installing any of the above packages ALL extensions will be installed.
The _nb_ext_conf package will also be installed, which activates the extensions.*


.. _uninstall-extensions:

Uninstall
---------

To remove all Jupyter Notebook Extensions run::

    conda remove nb_conda

To disable Jupyter Notebook Extensions individually, but not uninstall 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: <ENV_PREFIX> can be the root environment or any other conda environment where the extensions have been installed.


.. _notebook-present:

1. Notebook Present
===================

Turns your notebook into a PowerPoint-style presentation. Two new 
buttons are visible in your top menu bar: Edit Presentation, and Show 
Presentation: 

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

To begin using Notebook Present, click the Edit Presentation button. 
A black bar with several menu items appears on the right side of your 
browser. As you click each icon, the menu and layout of your screen 
changes. 

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

Click the Help icon to view three quick tours of the main features of 
Notebook Present. The tours are: Intro Tour, Slides Tour, and Editor 
Tour.


**Intro tour** 

Click Help - Intro to see a 2-minute presentation on how to use all 
of the main features. Every button is explained, and you can pause, 
go back to the previous slide, or the next slide. Here is a summary 
of the presentation.

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

.. image:: /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, just click the Show Presentation button.

Presenting/Authoring: Once you've 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, made of Regions linked to Cell Parts are the bread 
and butter of any presentation, and can be imported, created, linked, 
reordered, and edited here.

.. image:: /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 will become the default, while you can choose custom themes for 
a particular slide, like a title.

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

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

Downloading: After you've made a presentation, you can download it as an 
HTML page by choosing Download → Download As: Presentation (.html) in the 
menu.

Help: Activate Help at any time to try other tours, connect with the 
Present developers and community, and other information. 

**Using slides**

From the Help menu, clicking Slides brings up the following 2-minute 
presentation on how to create and manage slides:

.. image:: /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 will 
offer some choices for creating your new slide.

Import: The quickest way to a presentation is to just 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: Or 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, 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 only 
be reliably updated when a linked Cell Part is on-screen 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.

**Using the editor**

When you click Help - Editor, you see the following 2-minute presentation 
on editing your notebook:

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: This is the Region editor. You can click and drag Regions 
around and resize them.

Region Tree: This is the Region tree. It lets you reorder Regions and see 
the details of how your Regions will 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, like this Treemap, which will fill 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:

2. Notebook Anaconda Cloud
==========================

Upload your notebook to your Anaconda Cloud account with the 
push of a button:

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

Optionally, a copy of your conda environment (environment.yaml) can be 
embedded in the metadata.

NOTE: You must have an Anaconda Cloud account for this extension 
to work. You can sign up for a free account at anaconda.org. 

If you haven't signed in to Anaconda Cloud before, a dialog box 
appears asking for your Anaconda Cloud username and password. 

Or if you already have an account, you may login at the command line::

    anaconda login

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

To begin, open Jupyter Notebook, then open the notebook you wish to 
upload to Anaconda Cloud. In the top navigation bar, click the "Publish to 
Anaconda Cloud" button: 

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

The following dialog box appears:

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

Select your username, write a description 
of the notebook that will appear on Anaconda Cloud, and optionally check the 
"Attach conda environment" box if you want the identical environment to be 
included when the notebook is downloaded and opened. Then click the "Publish" 
button. 

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

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


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

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


For more help using Anaconda Cloud, see https://docs.continuum.io/anaconda-cloud/

.. _notebook-conda:

3. Notebook Conda
=================

Provides Conda environment and package access from within Jupyter Notebook. 

**Manage all environments**
While viewing the dashboard file manager, select the Conda tab. This shows your 
current conda environments:

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

After you have selected an environment by clicking its name, you'll see the package 
management section display below it. 

You can also add a new conda environment by clicking the "+" button above the list of
environments. 

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

**Icons from left to right:** Search for packages in your current environment, 
refresh your packages list, update selected packages, or remove selected packages.

NOTE: For more information on using and managing conda packages, 
see http://conda.pydata.org/docs/using/pkgs.html 


**Manage Current Kernel Environment**

From the Kernel menu, select Conda Packages:

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

This displays a list of the Conda Packages in the current environment. The icons are 
the same as above: Search for packages in your current environment, 
refresh your packages list, update selected packages, or remove selected packages.


.. _notebook-conda-kernels:

4. Notebook Conda Kernels
=========================

This extension makes the Notebook aware of your conda environments, 
and is required for Notebook Anaconda Cloud and Notebook Conda. 
When creating a new notebook, from the Files tab, you can pick any 
of the Python or R language kernels in any of your environments:

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

Or change to those kernels on a current notebook:

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