Useful extensions of Jupyter with Nbextension: installation and examples of use

Image by author

To run the jupyter you can download the Github repository.

Install nbextensions

pip install jupyter_contrib_nbextensions

After the installation, it is possible that you have to restart jupyter for the Nbextensions menu to be visible.

❗ If you don’t see the toolbar even after restarting jupyter ❗

You can try going to your command prompt and typing this in sequence :

jupyter contrib nbextension install --user
jupyter nbextension enable varInspector/main

Don’t forget to refresh the page.

Nbextensions appears in the Jupyter menu as shown in the picture below :

Image by author

Click on Nbextensions, and you will arrive on the interface below. An icon can be checked: “disable configuration (…)”. Uncheck it.

Image by author

Once the icon is unchecked you can install extensions by simply checking them. Let’s try several examples together!

Example of extensions that we will test

1- Collapsible Headings

2- Skip-Traceback

3- Table of Contents

4- Variable Inspector

5- Hide input

📌 Collapsible Headings is an extension of Jupyter Notebook that allows you to compress text/code cells by header size.

Image by author

Once Collapsible Headings is checked, you have to close your Notebook and re-open it for the extension to apply. Don’t forget to save it before!

Image by author

Once the notebook is reopened, you can see that the headers have small arrows pointing downwards, which means that the extension is well installed.

You can now click on an arrow and notice that all cells below the header that are smaller than the header are compressed.

This is very handy to display all the parts of your project or code!

📌 Skip-Traceback compresses error messages. An example below :

Without Skip-Traceback :

Image by author

With Skip-Traceback :

Image by author

📌 Table of Contents displays a table of contents in a floating window, and automatically numbers the headings.

Without this extension :

Image by author

With the Table of Contents extension :

Image by author

Finally, to display the table of contents just click on the icon that appeared on the right side of the menu as shown in the image below :

Image by author

📌 Variable Inspector displays a floating window of the values of all defined variables.

To display this table click on the icon that appears on the right side of the menu as shown in the image below :

Image by author

Exemple :

Image by author

📌 Hide Input hides the cells.

To activate the hiding, place yourself on a cell (code or text) and click on the icon that appears on the right side of the menu as shown in the image below :

Image by author

There are still a lot of features! It’s up to you to find the one that suits you :)

Hi! I am a last year student in an engineering school and I am passionate about data science. Whatever the type of data, I love to dig in!