nteract / hydrogen

:atom: Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.
https://nteract.gitbooks.io/hydrogen/
MIT License
3.92k stars 334 forks source link

Variable inspector / workspace view #64

Open faroit opened 9 years ago

faroit commented 9 years ago

I love the idea of hydrogen, and I think this is good step into the right direction towards atom as a scientific dev environment! Thanks for the work so far.

One step further additionally to the "watch" mode would be to list variables of the current scope. The result would then be a variable / workspace view which automatically refreshes so users get a quick view on all their variables and their content. This view could also allow to click on the variables to show the content of arrays, images, matplotlib plots etc...

This would reflect something which is common in IDE's like Spyder or Matlab (see screenshot) image


This has been added to the Hydrogen Wiki Plugins. If you close this issue please remove it from the Hydrogen Wiki.

willwhitney commented 9 years ago

This is something I've thought about a lot, and it's something I'd love to see in Hydrogen. That being said, I'm only willing to include features that are language independent.

I'm probably going to be working with the Jupyter team to improve the protocol to support this and other rich features. That won't have results for a few months, though.

How are you thinking of implementing this?

sho-87 commented 9 years ago

I would love to see this as well.

I really want to move away from Spyder (especially given its recent problems with Windows 10) but the variable explorer keeps me using it. Hydrogen with the watch list is a huge step in the right direction, but its not quite the same thing.

slavaGanzin commented 9 years ago

Besides maybe add ctrl-shift-enter or whatever shortcut to add to watch?

onyxfish commented 8 years ago

I'd love to see this too. I've been tracing through Jupyter trying to figure out what would be necessary to support this sort of case globally and it seems like it could potentially be extremely complicated. The jupyter_client spec would need to implement some concept of a "variable". In the most basic case this would map to the contents of Python's globals(). However, in order to support jupyter's pubsub model you would need debugger like control over the execution environment. I'm not even sure it's feasible to do this in languages with less introspection than Python.

I'm wondering if an alternative to waiting for all this infrastructure might be to build out the watch list into a more automated UI. For instance, can we piggy-back on Atom's grammars to determine if the user's cursor is on a variable and display an "Watch this variable" button popup? Or maybe it's in the right-click menu?

slavaGanzin commented 8 years ago

Jupyter is used for teaching and not highefficient programming, so maybe let's add continuous evaluator of all grammars? And display just meaningful ones. In dynamic languages only way to get the scope of selected piece of code is to launch it to this line included. And that only if code is imperative. So hidden launch of code would be best solution, but what if I modify filesystem with my code? Another way to remember all scope iteratively, but that would be definitely a lot of overhead code for hydrogen. And as Will mentioned should be conceptually implemented in Jupyter.

slavaGanzin commented 8 years ago

@onyxfish "Add watch" command was merged into master. Parsing grammars is easy. And auto adding all variables into watches is easy too. If this would be approved I can write it fast.

But what about scopes?

sho-87 commented 8 years ago

@willwhitney any updates on your work with the jupyter team and whether this feature is likely to be added in the near future?

willwhitney commented 8 years ago

Don't hold your breath — this idea is on the back burner right now, as I'm finishing up a thesis and the Jupyter team is in the throes of a refactor. However, if you're interested in pitching in on the Jupyter side of things, they love PRs!

nikitakit commented 6 years ago

I have a proof-of-concept that implements a basic variable inspector using the just-merged plugin API updates: https://github.com/nikitakit/hydrogen-python

screen shot 2018-02-21 at 1 33 14 pm

It should be quite doable to turn this into a fully-working plugin. That said, I'm not sure what the priority features for a variable inspector are, besides showing basic variable info. Existing environments offer a bunch of capabilities for editing/plotting/saving/loading, but I have no idea which of these features actually see non-trivial use.

faroit commented 6 years ago

Wow, this is awesome! 🍾

From my own experience, I did never used these kind of advanced features in MATLAB® etc., type and shape is pretty much all I need... so you nailed it 👍

I will have a detailed look later and I guess it makes more sense to continue discussion in the python plugin

lgeiger commented 6 years ago

Great work @nikitakit!

Do you want to add a link to this package to our readme? After that I think we're good to go and make a new release so people can try it out.

willwhitney commented 6 years ago

This is great! It's one of the things I most wished I could add when I was first building Hydrogen. Awesome work @nikitakit!

AntonisKoutounidis commented 6 years ago

@nikitakit This is really nice.

Save and load is crucial I think. Many people use python for data science and machine learning tool. So, save and load a workspace is really useful.

ktavabi commented 6 years ago

So this would be a fantastic feature especially if it were more fluidly available i.e., opening up once workspace is populated by user defined variables. Nevertheless, I managed to toggle it on and recieved...

No introspection available! 😞

nikitakit commented 6 years ago

@ktavabi The command you need to run isHydrogen Python: Toggle Variable Explorer, not Hydrogen: Toggle Inspector

johndpope commented 6 years ago

so awesome work @nikitakit - To be upfront - I stumbled across this library after looking at ways to integrate livepython with ipython. @agermanidis - managed to expose a variable explorer which works well and I love it's simplicity and playback feature. https://github.com/agermanidis/livepython/

screen shot 2018-06-21 at 10 22 34 am

I was looking at this code base - and looking to plug in the ipython capabilities to like spyder ide / that is I want to retrofit hydrongen into livepython. I subsequently found another sidecar project which is almost integratabtle. https://github.com/nteract/sidecar/issues/46

screenshot 2

then read that there's nteract which has plotly all out of the box with nice ui candy.

my use case is I want to launch tensorflow training python app from terminal and be able to inspect variables print graphs / dataframes like spyder ide. my goto editor is visual studio code - but they don't want anything to with a variable explorer - https://github.com/Microsoft/vscode/issues/29971

ailiyasi11 commented 6 years ago

hi, I am new to this. How do you open this feature? I am using atom with python 3 kernel, where do you run Hydrogen Python: Toggle Variable Explorer ? in script or? @nikitakit

kylebarron commented 6 years ago

Press ctrl-shift-P to bring up the command palette. That's where you run all the Atom commands. You also need to install the hydrogen-python package to get the variable explorer. You can search for that in the install menu.

hmanuel1 commented 5 years ago

Hi, I'm new to Atom and Python...I followed the instructions on this thread, but I'm unable to get the Variable Explorer to show up. Hydrogen is working fine otherwise. Any advise. I have entered the command from the command palette (typing the command). I can't see the command to show up. I also created shortcut for this command "hydrogen:toggle-variable-explorer", but it doesn't work either. Any clue on how to troubleshoot the installation of this plugin? Thanks!

jdrogers42 commented 5 years ago

@nikitakit I'll add my vote for this being a useful feature. As for which other features see nontrivial use, I would say priority 1 is ability to just see the variable and the size/shape of arrays is my biggest use, so you have it! Thanks

@hmanuel1 I also did not see the hydrogen command initially, but it should show up in the command palette autocomplete after you install the package hydrogen-python. You probably need to restart hydrogen after installing the package.

paul-grassl commented 5 years ago

Is there any planning to make this really useful feature also available for R? (as described in #628 I mean) Cheers!

Mixpap commented 5 years ago

The variable explorer is a very useful tool, I noticed that for python pandas DataFrames doesn't resolve their size. A nice example of this working as it should is Jupyter's notebook extension Variable Inspector, which gives you the size/shape of the DataFrame.

SilvesterHsu commented 4 years ago

The plug-in can only see surface data, not specific data. For example, when you create a new Pandas DataFrame, you cannot see the data in it, and it is the same with numpy array.