Jupyter notebooks are a great environment to run Python, especially for teaching. I’m using them for almost all my teaching material. However, compared to IDE like Spyder, PyCharm or Visual Studio, Jupyter notebooks lack some features that are indeed quite useful, e.g., when you prototype new code. One of these features is the option to quickly explore the variables that are defined in your active session. Fortunately, there are so-called Jupyter Notebook Extensionsꜛ, which expand Jupyter’s functionality. Such extension is the Variable Inspectorꜛ, that adds the missing option to explore variables from within a running Jupyter notebook.
If not yet done, first install the Jupyter Notebook Extensions via
pip install jupyter_contrib_nbextensions jupyter contrib nbextension install --user
or for a virtual environment:
pip install jupyter_contrib_nbextensions jupyter contrib nbextension install --sys-prefix
Then enable the Variable Inspector extension via:
jupyter nbextension enable varInspector/main
Another way to install the Jupyter Notebook Extensions is of course via the package manager of your IDE.
You can enable the Variable Inspector also via the new Nbextensions menu in the Jupyter main window:
From now on, a new button will appear in your notebook’s menu bar (it looks like a target marker) to open the Variable Inspector:
Explore more extensions
Feel free to explore the other notebook extensions listed in the Nbextensions menu. They extend your Jupyter environment with some handy extra features like a table of contents (Table of Contents),
or the option to fold your code and save some space within your notebook (Codefolding),
or the so-called “zenmode”, which offers a more distraction-free Jupyter experience: