Is there a variable explorer in Jupyter (IPython) like in Spyder? It is very uncomfortable having to print the list of variables all the time each time I run through the test code.
Has this feature been implemented yet? If so, how to enable it?
Is there a variable explorer in Jupyter (IPython) like in Spyder? It is very uncomfortable having to print the list of variables all the time each time I run through the test code.
Has this feature been implemented yet? If so, how to enable it?
This might help you, though it's not exactly what Spyder offers and is much simpler:
To get a list of all currently defined variables, run who :
In [1]: foo = 'bar'
In [2]: who
foo
For more detail, run whos:
In [3]: whos
Variable Type Data/Info
----------------------------
foo str bar
For a complete list of built-in functions see Magic Commands
If you use Jupyter Notebooks within Jupyter Lab there has been a lot of discussion about implementing a variable explorer/inspector. You can follow the issue here
As of right now there is one Jupyter Lab extension in the works that implements a Spyder-like variable explorer. It is based on the notebook extension that James mentioned in his answer. You can find the lab extension (with installation instructions) here: https://github.com/lckr/jupyterlab-variableInspector
Another solution would be to connect the spyder-console to the running kernel
On any platform it would be:
from jupyter_client import find_connection_file
print(find_connection_file()) #this will show which json-file is associated to your jupyter
it should give you something like: ~/.local/share/jupyter/runtime/kernel-<SOME-ID>.json'
Perks of this method is that you don't need to install an aditionnal package you just need spyder & jupyter.
EDIT: I was too optimistic, but it seems that spyder also has a problem,I can use the variables in the console, but it doesn't show the variable in the actual GUI/browser. I'm leaving the answer in the hopes that this will be fixed in the future. (it may also work depending on the version you installed). Maybe a solution would be to connect the jupyter to an existing kernel, but I haven't been able to make it work. Any help is welcome !
A more manual but alternative way which can be complementary it to use https://github.com/google/etils
!pip install etils[ecolab]
Then
from etils import ecolab
ecolab.inspect(globals())
This display an interactive visualisation to recursively inspect arbitrary python objects (similarly to Chrome JS console).
For example:
There's also a ecolab.auto_inspect()
which add an inspect
button on all cells output:
Currently this only work on Google Colab but I'm working on adding support for arbitrary jupyter notebook (contributions welcome).
UPDATE
Scroll down to the section labeled update for a much less convoluted method.
OLD ANSWER
Here is a notebook on how to make your own Variable Inspector. I think it was written back when jupyter notebook was called ipython notebook but it works on the latest version.
I'll post the code below just in case the link breaks.
Run inline with the following:
Make it a javascript pop out;
UPDATE
Date: May 17 2017
@jfbercher created a nbextension variable inspector. The source code can be seen here jupyter_contrib_nbextensions. For more information see the docs.
Install
User
Virtual environment
Enable
Here's a screen-shot;