-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement variable inspector for kernels #443
Comments
Hi @SelimRABOUDI, this feature would be a most welcome contribution. |
👍 Would be a great project for a community developed extension. |
Great idea and +1 to someone from the community implementing this plugin. A design question: would you want to know the ENV vars for kernels or the main notebook server, or both? |
I'm afraid there is a misunderstanding between the title of this issue and the description. OP seems to be asking more or less for the "Workspace Variables" block as can be seen in Matlab or similar programs, and not for the Environment variables which are a complete different thing. Quoting him:
I suggest changing the title of the issue to accurately reflect the description. |
@zertrin : indeed I've used the wrong vocabulary. Correcting the title. A positive side-effect of my mistake is that the idea of an "ENV vars" block could also be relevant. I'll look into how I can do a first implementation of the "in-memory vars" block (if you think it still makes sense ?) |
I heard a couple people at SciPy express interest in a feature like this. Could it be done with a thin wrapper around IPython's |
If not, we can add one ;). |
If you have the kernel, you can connect to |
(brainstorming here...) Maybe we should have the concept of "kernel widgets" which are widgets that interact with a single kernel. You could open such a widget from a tab listing all running kernels, or maybe there would be a way to open the widgets from the kernel indication in a document. This variable explorer would be an example of a kernel widget. Likely a kernel widget could depend on the type of kernel, or it could be available for all kernels. On the other hand, if this variable explorer was a kernel widget, what would we do if the notebook we launched it from started a different kernel? Would we want the variable explorer to automatically know to switch to the new kernel? I think that's probably what the user would expect, so the notebook that launched the kernel widget should keep a handle on it so it could change the kernel. |
Here again the notion of an "active" kernel could be useful, so the user doesn't need to select the kernel for such a widget. (mentioned in #450 (comment)) |
I usually have more than one kernel running at a time, and I think I'd have trouble keeping track of which one was "active." I like @jasongrout's idea that kernel widgets like a "variable explorer" could be launched from a notebook and retain references in both directions. Other kernel widgets (like an HDF5 viewer) might close over a private kernel used only by that widget. |
Love the idea of a kernel widget. In our case, we'd love to develop a widget that knows the state of its kernel and displays information to the user based on it. In this case, the state is user variables, but in the case of a Spark kernel, it might be the connection string that the kernel is using to connect to Spark, as well as general information regarding this Spark instance. If a user has multiple notebook tabs open, I believe good UX would be to have the widget change contents appropriately as the user selects multiple notebook tabs. One way of achieving this might be that kernel widgets are part of the notebooks JupyterLab panel, and can be minimized/maximized/docked/undocked in the context of the notebook panel. |
This feature would make JupyterLab a closer Pythonic analogue of Matlab's IDE |
Yes, please. With knobs on. This is absolutely essential for scientific programming as is a visual debugger with breakpoints. |
The least it should show somehow is the keys and column names of dicts and tables. Looking up those identifiers happens very often. Maybe in a tooltip or expandable view. |
Spyder IDE already has this for their IPython consoles (Spyder tries to be similar to Matlab IDE), and is licensed under MIT. Even if the language/framework used is different, it could serve as a source of inspiration. |
Spyder is ok but a friend recently showed me Rstudio and it was very impressive, very close to Matlab's UI and now has a notebook capability. I don't think it fully supports other kernels though. It is good enough that I am thinking about learning R. |
Is there a separate issue/feature request for a visual debugger? I guess it should have to be developed as an extension. Perhaps this Python 3.7 addition will be of great help: |
There isn't an issue for a debugger, please feel free to open one, @Juanlu001. |
Done! #3049 |
This feature is one of my favorites in RStudio, and would love to see it in JupyterLab. Especially nice if combined with the ability to click dataframes and explore them (similar to |
Considering that such an extension exists, I guess I should modify that to "anybody who's developing such an extension ". |
I have installed the extension and it works perfectly - any chance it could support the Matlab kernel too? |
Hello Guys, I'm trying to use the variable inspector with R kernel. It shows to me the environment variables perfectly. My doubt is about opening data frames. It is possible with R kernel? In my case, It's only working with python, but with R it is not. There is some possibility to open a R dataframe? Thanks, |
it seems that the author of the variableinspector extension may not be actively maintaining it and so it's not compatible with JupyterLab3. (see here). I'd love to see this functionality be rolled into the core JupyterLab functionality, as has been done with the debugger. As is, I'm sticking with JupyterLab2 for now just because I really love the variableinspector extension. |
FYI, if I recall correctly, a variable inspector is on the roadmap for the debugger extension. |
Updating that extension may be as simple as bumping the dependencies at https://github.com/lckr/jupyterlab-variableInspector/blob/50c522c613c6ce59fa19f88e4c7db11fa4b1dd56/package.json#L34-L40 |
Is it possible to return all defined variables as a list programmatically without using the magic command ( |
Sounds like you may want the Python |
The list of variable names defined in the notebook is to be passed into a function defined in a Python script. globals(), locals(), dirs() won't work in this case, as they only list the functions and variables defined in a Python script, not the actual ones defined in a notebook. I want to use the list of various names in an ipywidgets DropDown list within an ipyleaflet Map object. |
I meant to call |
For example, the function below is defined in a module of a python package. When calling this function (from a *.py file) within Jupyter notebook,
|
I think we are probably talking past each other, since it sounds like both of us understand how things work. My thought is that you could use |
Are there any updates on this? |
From my understanding this was released recently: https://github.com/jupyterlab/jupyterlab/blob/f0790b3ffd187b7dc923156b8ae227855abecefb/packages/inspector/README.md. There is now a little bug on the side of the jupyterlab panel, where the variable inspector is. |
Yeah thought this was done a while ago (unless I'm misunderstanding the ask) https://blog.jupyter.org/a-visual-debugger-for-jupyter-914e61716559 |
That requires using some niche kernel, where matplotlib and other libraries don't work. |
The blog post is outdated: ipykernel, the mainstream kernel, supports the debugging protocol since 6.0.0, released in June 2021: https://github.com/ipython/ipykernel/releases/tag/6.0.0, https://jupyterlab.readthedocs.io/en/stable/user/debugger.html#requirements |
Sounds like this issue should be closed then? |
That sounds like a new issue. Given this issue was about implementing the feature (as opposed to usability bugs with the feature) |
Fine with me. |
Just to point out, since JupyterLab 3.3 you can hover over the list and click loop icon (or-right click to be offered an option to render the variable), as in: Currently it uses the default MIME type but we should be able to do better (like render a table for tabular pandas/numpy data even if currently we show just the default HTML preview). @Atcold Did you open a new issue? We have a triage process which means that comments on old issues may not receive the same attention as new issues (and definitely we cannot tag a meta-issue for any specific release). @jakirkham I personally would not consider this one closed as it required a debugger-enabled kernel. |
@krassowski: done. |
Hi,
It is useful when doing interactive data analysis to quickly get the name/quick summary (type/ size) of in-memory variables.
I was wondering if having a block for displaying this kind of information could be an interesting feature for JupyterLab ? Such as the one in RStudio:
The text was updated successfully, but these errors were encountered: