Skip to content
jcb91 edited this page Sep 2, 2015 · 26 revisions

There is a graphical user interface for activating/deactivating installed notebook extensions by going to the '/nbextensions' URL:

This is realized using a notebook server extension, new to IPython 3.x. In order to work, this extension needs to be installed, and notebook extensions require a YAML description file in '~/.ipython/nbextensions' (or a subdirectory thereof) in order to be found.

#Setup procedure ##1. Installation All required files are originally located in the 'config' subdirectory of the repository.

  • copy 'main.js' and 'main.css' to your '~/.ipython/nbextensions/config' folder
  • copy 'nbextensions.py' to your '~/.ipython/extensions' folder
  • copy 'nbextensions.html' to your '~/.ipython/templates' folder

##2. Configuration Add the following lines to your 'ipython_notebook_config.py' file (inside your profile directory, e.g. ~/.ipython/profile_default/):

from IPython.utils.path import get_ipython_dir
import os
import sys

ipythondir = get_ipython_dir()
extensions = os.path.join(ipythondir,'extensions') 
sys.path.append( extensions )

c = get_config()
c.NotebookApp.server_extensions = ['nbextensions']
c.NotebookApp.extra_template_paths = [os.path.join(ipythondir,'templates') ]

#YAML file format The YAML file can have any name with the extension YAML, and describes the notebook extension. Note that keys (in bold) are case-sensitive.

  • Type - identifier, must be 'IPython Notebook Extension'
  • Name - unique name of the extension
  • Description - short explanation of the extension
  • Link - a url for more documentation
  • Icon - small icon (rendered 120px high, should preferably end up 400px wide. Recall HDPI displays may benefit from a 2x resolution icon).
  • Main - main file that is loaded, typically 'main.js'
  • Compatibility - IPython version compatibility, e.g. '3.x' or '4.x' or '3.x 4.x'
  • Parameters - Optional dictionary of configuration parameters, each of which may have properties:
    • name - unique (among all extensions) name of the configuration parameter
    • description - description of the configuration parameter
    • input_type - controls the type of html tag used to render the parameter on the configuration page. Valid values include 'text', 'textarea', 'checkbox', [html5 input tags such as 'number', 'url', 'color', ...], plus a final type of 'list'
    • list_element_type - for parameters with input_type 'list', this is used in place of 'input_type' to render each element of the list
    • finally, extras such as min step max may be used by 'number' tags for validation

Example:

Type: IPython Notebook Extension
Name: Limit Output
Description: This extension limits the number of characters that can be printed below a codecell
Link: https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/limit-output
Icon: icon.png
Main: main.js
Compatibility: 3.x 4.x
Parameters:
  limit_output:
    description: Number of characters to limit output to
    input_type: number
    default: 10000
    step: 1
    min: 0

Clone this wiki locally