-
Notifications
You must be signed in to change notification settings - Fork 0
Home 4.x (Jupyter)
The Jupyter notebook functionality (i.e. what you do with the Browser) can be extended using Javascript extensions. This repository contains a collection of such extensions. The maturity of the provided extensions may vary, please create an issue if you encounter any problems.
Some extensions may work with other languages than Python, however this currently has not been tested.
There are different branches of the notebook extensions in this repository. Please make sure you use the branch corresponding to your IPython/Jupyter version. Not all extensions are available for all versions.
| IPython/Jupyter Version | Description |
|---|---|
| 1.x | not supported |
| 2.x | checkout 2.x branch |
| 3.x | checkout 3.x branch |
| 4.x (Jupyter) | checkout master branch |
Note: This is not related to the Python version.
Jupyter/IPython 4.x works differently than IPython 3.x.
- The notebook was split from IPython. You need to install both to run the notebook with IPython now. The easiest way is to use Anaconda and do a
conda install jupyter - There are no profiles anymore. You can specify environment variables to change the default, see Jupyter ML].
- The configuration has moved to a new place. To find out where, see below.
- There is a kind of automatic upgrade of the configuration files from IPython 3.x to Jupyter.
To find where the configuration files are, start IPython
from __future__ import print_function
from jupyter_core.paths import jupyter_config_dir, jupyter_config_path
print(jupyter_config_dir())
print(jupyter_config_path())jupyter_config_dir() shows you where your local configuration files are, jupyter_config_path shows you where Jupyter will look for configuration files. For the notebook, there are two files that will be used:
jupyter_notebook_config.py and jupyter_notebook_config.json.
The nbextension directory has moved to a different location and can be found in one of these directories:
from __future__ import print_function
from jupyter_core.paths import jupyter_data_dir, jupyter_path
print(jupyter_data_dir())
print(jupyter_path())You can check if the directory or a file (or list of files) exists:
import notebook
notebook.nbextensions.check_nbextension('usability/codefolding', user=True)
notebook.nbextensions.check_nbextension('usability/codefolding/main.js', user=True)Make sure to use user=True if you have the extensions installed in your local path (in jupyter_data_dir()).
To enable an extension:
import notebook
E = notebook.nbextensions.EnableNBExtensionApp()
E.enable_nbextension('usability/codefolding/main')To disable an extension:
import notebook
D = notebook.nbextensions.DisableNBExtensionApp()
D.disable_nbextension('usability/codefolding/main')The configuration is stored in either jupyter_config_dir()/notebok.json or jupyter_config_dir()/nbconfig/notebook.json depending on your Jupyter (4.0.xx or master) version.
If you reload the notebook after enabling a notebook extension, the extension will be loaded. You can check the Javascript console to confirm.
The repository is organized in different categories:
| Name | Description |
|---|---|
| usability | Additional functionality for the notebook |
| publishing | Getting your notebooks out in the wild |
| styling | Styling schemes for different looks of the notebook |
| slidemode | Slideshow creation |
| testing | Extensions in a early stage |
| File or Directory | Description | Status |
|---|---|---|
| chrome_clipboard | Add system clipboard actions with Chrome | working |
| codefolding | Fold code blocks using Alt-F or clicking on gutter | |
| comment-uncomment.js | Toggle comments in selected lines using Alt-C | |
| executeTime.js | Display when each cell has been executed and how long it took | |
| drag-and-drop | Allow dragging of images into a notebook | working |
| hide_input_all | Hide all codecells in a notebook | |
| latex_envs | (some) LaTeX commands and environments in markdown cells | working |
| limit-output | Limit codecell output | working |
| navigation-hotkeys | Change hotkeys for navigation in notebook | |
| python-markdown | Display Python variables in markdown | |
| read-only.js | Allow codecells to be set read-only, so no editing is possible | |
| rubberband | Multi-cell selection tool | |
| runtools | Add toolbar buttons for additional code execution options | |
| search-replace | Add a toolbar for notebook-wide search and replace | working |
| skip-traceback | Don't display traceback, only error type and message | working |
| File or Directory | Description | Status |
|---|---|---|
| printview-button | Add a toolbar button to call nbconvert --to html for current the notebook and display html in new browser tab. Uses current user profile. |
|
| htmltools/js_highlight.py | A python tool to customize the css classes of nbconvert's html code blocks to fit your favourite JS syntax highlighter | untested |
| File or Directory | Description | Status |
|---|---|---|
| styling/css_selector | ||
| styling/zenmode |
| File or Directory | Description | Status |
|---|---|---|
| slidemode | Make slide creation for reveal.js easier |
| File or Directory | Description | Status |
|---|---|---|
| hierarchical_collapse | Adds a button to hide all cells below the selected heading | |
| history | ||
| swc | ||
| cellstate |
Installing and activating notebook extensions works differently in Jupyter compared to previous (<4.x) IPython versions. Please be aware that since Jupyter is still in development, some commands may change in the future.
There is a graphical interface for activating/deactivating notebook extensions now. You might want to use it: config-extension
- Installing an extension
jupyter nbextension install <name of extension>
Example:
jupyter nbextension install usability/codefolding/main
- Activating an extension
jupyter nbextension enable <name of extension>
- Deactivating extensions
jupyter nbextension disable <name of extension>
- Viewing activated extensions
You can generate a table of currently activated extensions by executing the following in a notebook cell:
from IPython.html.services.config import ConfigManager
from IPython.display import HTML
ip = get_ipython()
cm = ConfigManager(parent=ip, profile_dir=ip.profile_dir.location)
extensions =cm.get('notebook')
table = ""
for ext in extensions['load_extensions']:
table += "<tr><td>%s</td>\n" % (ext)
top = """
<table border="1">
<tr>
<th>Extension name</th>
</tr>
"""
bottom = """
</table>
"""
HTML(top + table + bottom)If the extension does not work, here is how you can check what is wrong:
- Clear your browser cache or start a private browser tab.
- Verify the extension can be loaded by the IPython notebook, for example:
http://127.0.0.1:8888/nbextensions/usability/runtools/main.js - Check for error messages in the JavaScript console of the browser.
Feel free to improve this Wiki documentation.
Aspell
Breakpoints
Chrome Clipboard
Codefolding
Comment Uncomment
Drag and Drop
Execute Timings
Help Panel
Hide Input All
Hierarchical Collapse
International Keymap
Javascript Highlighter
LaTeX Environments
Limit Output
Linenumbers
Navigation Hotkeys
Nbconvert Button
Printview Button
Printviewmenu Button
Python Markdown
Readonly
Rubberband
Runtools
Search & Replace
Search
Shift-Tab 3.x
Skip Traceback