Jupyter-contrib / jupyter_nbextensions_configurator

A jupyter notebook serverextension providing config interfaces for nbextensions.
Other
981 stars 121 forks source link
jupyter jupyter-nbextensions-configurator jupyter-notebook nbextension

Jupyter Nbextensions Configurator

Join the chat at https://gitter.im/jupyter-contrib/jupyter_nbextensions_configurator GitHub issues
Travis-CI Build Status Coveralls python test coverage Codecov python test coverage
GitHub tag PyPI Conda forge

A server extension for jupyter notebook which provides configuration interfaces for notebook extensions (nbextensions).

The jupyter_nbextensions_configurator jupyter server extension provides graphical user interfaces for configuring which nbextensions are enabled (load automatically for every notebook). In addition, for nbextensions which include an appropriate yaml descriptor file (see below), the interface also renders their markdown readme files, and provides controls to configure the nbextensions' options.

This project was spun out of work from ipython-contrib/IPython-notebook-extensions.

Installation

For those using conda, you can now get jupyter_nbextensions_configurator from the excellent conda-forge channel in a single command:

conda install -c conda-forge jupyter_nbextensions_configurator

For those not using conda, the installation has two steps:

  1. Installing the pip package. This should be as simple as

    pip install jupyter_nbextensions_configurator
  2. Configuring the notebook server to load the server extension. A jupyter subcommand is provided for this. You can enable the serverextension and the configurator nbextensions listed below for the current user with

    jupyter nbextensions_configurator enable --user  # can be skipped for notebook >=5.3

    The command accepts the same flags as the jupyter serverextension command provided by notebook versions >= 4.2, including --system to enable in system-wide config (the default), or --sys-prefix to enable in config files inside python's sys.prefix, such as for a virtual environment. The provided jupyter nbextensions_configurator command can also be used to disable.

Once installed, you'll need to restart the notebook server. Once restarted, you should be able to find the configurator user interfaces as described below.

Usage

Once jupyter_nbextensions_configurator is installed and enabled, and your notebook server has been restarted, you should be able to find the nbextensions configuration interface at the url <base_url>nbextensions, where <base_url> is described below (for simple installs, it's usually just /, so the UI is at /nbextensions).

configurator UI page

base_url

For most single-user notebook servers, the dashboard (the file-browser or 'tree' view) is at

http://localhost:8888/tree

So the base_url is the part between the host (http://localhost:8888) and tree, so in this case it's the default value of just /. If you have a non-default base url (such as with JupyterHub), you'll need to prepend it to the url. So, if your dashboard is at

http://localhost:8888/custom/base/url/tree

then you'll find the configurator UI page at

http://localhost:8888/custom/base/url/nbextensions

tree tab

In addition to the main standalone page, the nbextensions configurator interface is also available as a tab on the dashboard:

configurator UI in a dashboard tab

The dashboard tab is provided via an nbextension called "Nbextensions dashboard tab", with requirejs uri nbextensions_configurator/tree_tab/main. Since version 0.2.0, this nbextension is enabled by default on enabling the jupyter_nbextensions_configurator serverextension, but it can be disabled as with any other nbextension if you don't want to use it.

edit menu item

jupyter_nbextensions_configurator provides a second small nbextension, which simply adds an item to the notebook-view edit menu, which links to the configurator UI page:

configurator edit menu item

Similarly to the tree tab nbextension detailed above, since version 0.2.0, the edit menu item nbextension is enabled by default when enabling the main jupyter_nbextensions_configurator serverextension, but can be disabled at any time in the same way as other nbextensions.

YAML file format

You don't need to know about the yaml files in order simply to use jupyter_nbextensions_configurator. An nbextension is 'found' by the jupyter_nbextensions_configurator server extension when a special yaml file describing the nbextension and its options is found in the notebook server's nbextensions_path. The yaml file can have any name with the file extension .yaml or .yml, and describes the nbextension and its options to jupyter_nbextensions_configurator.

The case-sensitive keys in the yaml file are as follows:

Example:

Type: Jupyter Notebook Extension
Name: Limit Output
Section: notebook
Description: This nbextension limits the number of characters that can be printed below a codecell
tags:
- usability
- limit
- output
Link: readme.md
Icon: icon.png
Main: main.js
Compatibility: 4.x
Parameters:
- name: limit_output
  description: Number of characters to limit output to
  input_type: number
  default: 10000
  step: 1
  min: 0
- name: limit_output_message
  description: Message to append when output is limited
  input_type: text
  default: '**OUTPUT MUTED**'

Troubleshooting

If you encounter problems with this server extension, you can:

For debugging, useful information can (sometimes) be found by:

Changes

0.6.4

0.6.3

0.6.2

0.6.1

0.6.0

0.5.0

0.4.0

0.3.0

0.2.8

0.2.7

0.2.6

0.2.5

0.2.4

0.2.3

0.2.2

0.2.1

0.2.0

0.1.1

Remove tests dependency on ipython_genutils

0.1.0

First public release!



Making a new release of jupyter_nbextensions_configurator

This extension can be manually distributed as a Python package.


Manually bumb the package version in:

Update the Changes section of the this README with notes for the release.

To create the binary package (.whl) in the dist/ directory, do:

  python setup.py bdist_wheel

Commit the changes to the repository, and upload artifacts.

Install the necessary twine python package

  pip install twine

Then to upload the package to PyPI, do:

  twine upload dist/*

Lastly, you can follow the instructions here to make a manual release on Github via jupyter_nbextensions_configurator/releases.