Jupyter/Extensions: Difference between revisions
From charlesreid1
| Line 86: | Line 86: | ||
'require': 'ipyvolume/extension' | 'require': 'ipyvolume/extension' | ||
}] | }] | ||
</pre> | |||
To install it, the recommended method is: | |||
<pre> | |||
pip install ipyvolume | |||
jupyter nbextension enable --py --sys-prefix ipyvolume | |||
</pre> | |||
Or with a dev version (git): | |||
<pre> | |||
$ git clone https://github.com/maartenbreddels/ipyvolume.git | |||
$ cd ipyvolume | |||
$ pip install -e . | |||
$ jupyter nbextension install --py --symlink --sys-prefix ipyvolume | |||
$ jupyter nbextension enable --py --sys-prefix ipyvolume | |||
</pre> | </pre> | ||
Revision as of 09:14, 8 December 2017
Notebook extensions
To enable/install a notebook extension:
jupyter nbextension enable <nbextension require path>
Example: Jupyter/Base16mpl
Also see: https://github.com/ipython-contrib/jupyter_contrib_nbextensions
Server extensions
To enable/install a server extension:
jupyter serverextension enable <sererextension require path and flags>
Example: Jupyter/MPI
User-Contributed Notebook Extensions
Full instructions here:
Start by installing the different nb extensions available:
pip3 install jupyter_contrib_nbextensions
Install the notebook extension files:
jupyter contrib nbextension install --user
Command line options:
--user to install into the user's home jupyter directories
--system to perform installation into system-wide jupyter directories
--sys-prefix to install into python's sys.prefix, useful for instance in virtual environments, such as with conda
--symlink to symlink the nbextensions rather than copying each file (recommended, on non-Windows platforms).
--debug, for more-verbose output
To enable an extension:
jupyter nbextension enable <nbextension require path>
for example,
jupyter nbextension enable codefolding/main jupyter nbextension enable toc2/main
To disable the extension again, use
jupyter nbextension disable <nbextension require path>
Making An Extension
See ipyvolume: https://github.com/maartenbreddels/ipyvolume
Basically just defines a function _jupyter_nbextension_paths: https://github.com/maartenbreddels/ipyvolume/blob/master/ipyvolume/__init__.py#L12
And that's it.
def _jupyter_nbextension_paths():
return [{
'section': 'notebook',
'src': 'static',
'dest': 'ipyvolume',
'require': 'ipyvolume/extension'
}]
To install it, the recommended method is:
pip install ipyvolume jupyter nbextension enable --py --sys-prefix ipyvolume
Or with a dev version (git):
$ git clone https://github.com/maartenbreddels/ipyvolume.git $ cd ipyvolume $ pip install -e . $ jupyter nbextension install --py --symlink --sys-prefix ipyvolume $ jupyter nbextension enable --py --sys-prefix ipyvolume