Skip to content
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

can you please add Rstudio type dataframe-variable tree explorer? #628

Closed
data-steve opened this issue Mar 2, 2017 · 16 comments
Closed
Labels
enhancement 🌟 New feature ideas

Comments

@data-steve
Copy link

Admittedly this is a feature request, not a bug issue, but still....

So much value could be created with this one feature addition of having a dedicated pane to some of these project level views. None of the other python IDEs do this well and have any speed or aesthetic.

image

Noone has really given jupyter a run for that intermediate space between RStudio as the best IDE and Jupyter allowing you to work in multiple data science stacks/languages.

I love that you guys aren't looked into the cells behavior (R Notebooks went that way too which is better in my opinion).

@lgeiger
Copy link
Member

lgeiger commented Mar 2, 2017

@data-steve That would be a awesome feature, though that's quite hard to do in a language agnostic way. We discussed something similar in #64.

That would be a excellent plugin idea, which then can be language specific for R or Python and easier to implement. We could totally expose more functionality in our plugin API for this.

Sadly I must say don't hold your breath. Unless you or someone else takes a stab at implementing something like this (which would be super cool 😄) , it is currently on the back burner.

@BenRussert
Copy link
Member

Agreed this would be great. I think react inspector might be a good starting place.

I might experiment with this as a plugin and hopefully get some discussion going here if anyone else has some ideas/code.

@data-steve
Copy link
Author

data-steve commented Mar 23, 2017 via email

@lgeiger
Copy link
Member

lgeiger commented Mar 23, 2017

Rereading the issue makes me think that we may be able to support this simply by adding support for the application/json output type and utilizing the watch sidebar.
This way we don't have a complete variable explorer that shows all available variables from the current scope, instead one can add custom variables or expression to watch, similar to a debugger (we already support this). This has the advantage of being language agnostic as long as the library supports the application/json mime type.

nteract already has support for interacting with objects and exports the relevant React components in @nteract/display-area and @nteract/tranforms using react-json-tree. I think using this together with our Watch Sidebar would bring us very close to the desired behavior.

@BenRussert @data-steve Awesome that you are interested in experimenting with this! I started #655 which tries to bring in @nteract/tranforms to adds support for the above mentioned object output and more.
I would be super happy to have more people collaborating on this effort. 🎉

@data-steve
Copy link
Author

data-steve commented Mar 23, 2017 via email

@BenRussert
Copy link
Member

simply by adding support for the application/json output type and utilizing the watch sidebar.

@lgeiger I was really hoping you'd say something like this! I think this is a good fit for Hydrogen because it allows you to visualize data and objects and think about their structure as you write code.

@rgbkrk
Copy link
Member

rgbkrk commented Mar 23, 2017

This is something very common that I think we should be able to support across languages. However, when I say "we" I mean across the Jupyter ecosystem (kernels and frontends like Hydrogen).

We should start drafting a new message for the Jupyter protocol that could request available data frames or variables that are able to be exposed. Here's an example, using the same simplified psuedo-format as the building on jupyter post:

vars_request: {
  variables: [ // optional, would request all marked as available
    'x' // only request x
  ],
}
vars_response: {
  available: {
    x: { // some representation (could be mimetype style)
    }
  }
}

I'm thinking the frontend would cache as much as possible and when the user tries to expand a variable (or some other way of listing it), it would request to get the latest version.


As an aside, python provides both dir() for listing currently available objects and there's a __dir__ method that can be provided on an object to only show certain attributes for listing.

@lgeiger
Copy link
Member

lgeiger commented Mar 23, 2017

I wish I could help more than just cheering and wishlisting things. I have zero experience with React and barely any experience with javascript beyond basic web and d3 stuff.

No problem, don't hesitate to hack around in Hydrogen and ask questions. I'm just getting started with React as well. We're very happy to receive PRs even (or better: especially) if they are titled "This breaks everything but it's a cool idea" 😄
Plus their are a lot of super valuable ways to get involved, beyond just writing code. If you're interested please take a look at our new-contributor-friendly issues 🎉

Is that a sidebar thing as well?

I don't fully understand, but this GIF describes the behavior best: https://github.com/nteract/hydrogen#watch-expressions
Every time code is run, the plot is recomputed.

I was really hoping you'd say something like this!

Cool! Happy to have you on board! 👍

@lgeiger
Copy link
Member

lgeiger commented Mar 23, 2017

@rgbkrk Indeed a vars_request would be really cool and would allow frontends to implement a variable inspector supporting multiple languages like the one proposed in #64.

Based on your pseudo message, a general question: How would a vars_request for a single variable x differ from a execute_request with content x?

@rgbkrk
Copy link
Member

rgbkrk commented Mar 23, 2017

Based on your pseudo message, a general question: How would a vars_request for a single variable x differ from a execute_request with content x?

😆 Pretty much the same.

I was thinking that an empty vars_request would return a response with all of them

vars_request: {
}

However, there's a semantic difference here between execute and "vars", which is that execute's intention is to run code. Here we want to look at a variable in memory (this is up to the kernel). As a user, running:

>>> x

is "looking" at the variable, yet could have side effects. By posting the vars_request message, we're explicitly saying to view (and hope to be free of side effects).

⚠️ I'm just throwing these ideas around, so I wouldn't hold any of my thoughts here as concrete. ⚠️

@lgeiger
Copy link
Member

lgeiger commented Mar 23, 2017

By posting the vars_request message, we're explicitly saying to view (and hope to be free of side effects).

True, that may be very valuable for a kernel to know in certain cases.

I'm just throwing these ideas around, so I wouldn't hold any of my thoughts here as concrete

😂 Sure, me too

@data-steve
Copy link
Author

data-steve commented Mar 23, 2017 via email

@lgeiger
Copy link
Member

lgeiger commented Mar 23, 2017

Definitely something that would be great to look into.

Also, this seems like a nice enough feature to button-ize because I’d be using it all the time. Having to Control Panel and search for such an odd phrasing like Hydrogen: Toggle Watches is hard to remember

In Atom you can allways add custom keybindings by editing the keymaps.cson file. Though you're right a default shortcut would be handy. Any ideas?

@data-steve
Copy link
Author

data-steve commented Mar 25, 2017 via email

@abalter
Copy link

abalter commented Apr 11, 2017

I believe that the JupyterLab roadmap lists a variable inspector as a future development. And JupyterLab is under very active development. Maybe sharing some ideas with them could be useful.

@lgeiger
Copy link
Member

lgeiger commented Apr 11, 2017

@abalter That sounds great!

@data-steve In the next release we'll have support for JSON data structures:
transforms

To keep it clear, I'm going to close this issue.
We can continue the awesome discussion about the variable explorer in #64 and open new issues for other ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🌟 New feature ideas
Projects
None yet
Development

No branches or pull requests

5 participants