Useful extensions of Jupyter with Nbextension: installation and examples of use
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 :
Click on Nbextensions, and you will arrive on the interface below. An icon can be checked: “disable configuration (…)”. Uncheck it.
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
1. Collapsible Headings
📌 Collapsible Headings is an extension of Jupyter Notebook that allows you to compress text/code cells by header size.
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!
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!
2. Skip-Traceback
📌 Skip-Traceback compresses error messages. An example below :
Without Skip-Traceback :
With Skip-Traceback :
3. Table of Contents
📌 Table of Contents displays a table of contents in a floating window, and automatically numbers the headings.
Without this extension :
With the Table of Contents extension :
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 :
4. Variable Inspector
📌 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 :
Exemple :
5. Hide input
📌 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 :