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

VS Code Integration #449

Closed kuza55 closed 7 years ago

kuza55 commented 8 years ago

This concept is super cool and it would be great if it was integrated into my editor of choice, VS Code.

@rgbkrk mentioned that he has investigated this in the past

A windows release would be great, though I hear that is blocked on zmq binary issues.

A linux-only release would still be useful to me as well.

rgbkrk commented 8 years ago

Yeah, I think it's worth checking out. If I had more free time, I'd start mocking it up with some of the packages available from nteract on npm.

kuza55 commented 8 years ago

I don't know if I'll have much time to put in work on this either, but maybe you could outline the changes you think will be necessary to get this to work?

hebijiandai commented 7 years ago

Look at this,vscode support jupyter notebook and has no lag in Windows platform. qq 20170101174849

malarinv commented 7 years ago

@hebijiandai It does but it seems like it isn't language agnostic like hydrogen is.

rgbkrk commented 7 years ago

There's vscodeJupyter for this, I'm going to go ahead and close the issue. @DonJayamanne has done stellar work on VSCode + Jupyter. 😄

valmormn commented 6 years ago

vscodeJupyter is far behind hydrogen as a tool.

schlichtanders commented 6 years ago

maybe wait for the following issue to be resolved https://github.com/Microsoft/vscode/issues/3220

contang0 commented 5 years ago

vscodeJupyter didn't have updates for a year, and yes, it doesn't come even close to Hydrogen.

Atom has been unusable for people behind corporate proxies for like a year now and devs don't care. I doubt that things are going to get better for Atom now that Microsoft has bought github. Its two editors targeting the same audience and they're even built using the same framework. I love Atom, but what I would love even more is to see Hydrogen on VS Code.

jflam commented 5 years ago

Hi Folks, you should try our Python extension for VS Code - it has the beginnings of what we call the “Python Interactive Window” which you can think of as an editor-centric way of interacting with Jupyter, i.e., we’re not just dropping Jupyter into a web view tab in VS Code.

Extension: https://marketplace.visualstudio.com/items?itemName=ms-python.python Docs: https://code.visualstudio.com/docs/languages/python

Please let me know what you think!

rgbkrk commented 5 years ago

Thanks @jflam! What should non-Python users install for interactive Jupyter kernel usage in Visual Studio Code?

contang0 commented 5 years ago

@jflam , I think it looks promising, but in my view demarcating cells with "#%%" is a hassle. In Hydrogen I either run code line by line or select a block of code and run it. Results then appear either in the output window ("Python Interactive" in VS Code Python extension), or right after a Line/Block of code in the editor itself.

Is there a way to Run Selection/Line with Jupyter? I only see an option to send it to the terminal

image

jflam commented 5 years ago

@joolius totally agree. Look for that to be fixed in our next update. @ronglums - another data point :)

@rgbkrk great question. We thought about making this a general purpose thing (by having it installed as its own extension), but voted to put it first in the Python extension and then evaluate feedback about wanting other languages. This is totally a "let's focus the team on a singular goal" decision.

ronglums commented 5 years ago

@joolius, this is definitely on our list to resolve. The challenge, however, is that Shift+Enter used to run code in Python Terminal exclusively, and it may not be desirable to non-data science users if we were to take it over to run code in the Python Interactive window. Perhaps a user setting to toggle b/w the two? Would love to hear suggestions!

contang0 commented 5 years ago

@ronglums, it could be any key. My comment was rather there appears to be no command to Run Selection/Line in Jupyter. There is a Run Cell command, but that is different as it executes whatever is between "#%%" tags, and I want to execute only a single line (or selection) in Jupyter. Do you know what I mean? :-)

ronglums commented 5 years ago

@joolius, yes I do! :) We'll add that shortly.

neo-anderson commented 5 years ago

@ronglums There are many reasons why Jupyter+Hydrogen+pweave+Atom setup works well for me as a data scientist. It makes it possible to recreate the RMarkdown workflow for python along with the advantages of the powerful Atom editor.

I am so excited to see the new update to the Python extension in VS Code. If the above features can be added to VS Code or even improved upon, data scientists will be able to use VS Code to efficiently perform their tasks.

Sample source file:

# Title
Hello world! This is a simple markdown file.
```python echo=False
print("Run this code block using hydrogen. If you use pweave to export this file, this code block would not be exported because echo parameter is set to False for this block.")
BenRussert commented 5 years ago

Inline output display. The output from Jupyter is displayed as a frame/bubble under the statement that was run. Clicking this frame would copy the result into the clipboard. Handy.

Compared to atom, VSCode is pretty restrictive when it comes to extensions. I check back every now and then to see if we should look into porting hydrogen over, but I am not expecting that it will happen.

ronglums commented 5 years ago

@neo-anderson , thanks for the detailed notes! This is very helpful. :)

We have just added in the VS Code Python extension the ability to run any code selection (with or without %##) in the Interactive window. It's not released yet, but you can try out our insiders build.

Inline output display isn't feasible with the current VS Code UI, but we've looked into this and have an idea for how to enable it.

Source markdown scenario makes a lot of sense. It is not something we've closely looked at, but will keep in mind down the road.

Regarding the "maximize editor group" behavior, sounds like this issue: https://github.com/Microsoft/vscode/issues/62083. Please vote on it! :)

neo-anderson commented 5 years ago

@BenRussert Is it possible to use the interactive window of VS Code to display the output from Hydrogen? Are there other issues blocking the port?

Thanks for the response, @ronglums. Excited to hear the progress. Unfortunately, I couldn't get the insiders build to work. I installed the extension and I tried running some code. But the Interactive window only shows "/Users/aswinraj/.vscode/extensions/ms-python.python-2019.2.5135-alpha/out/datascience-ui/history-react/index_bundle.js is not a valid file name". Not sure how to fix it.

Good to know that you're thinking about inline output and markdown source. That would totally fit the data science workflow popularized by R Markdown.

BenRussert commented 5 years ago

@neo-anderson you can use the VSCode extension API to render outputs in a pane (some VSCode extensions do this) but not inline/block in an editor line we do with hydrogen.

Inline output display isn't feasible with the current VS Code UI, but we've looked into this and have an idea for how to enable it.

@ronglums I'd love to see what you are referring to here. Inline in an editor?

ronglums commented 5 years ago

@neo-anderson , not sure why the insiders doesn't work for you. :( @IanMatthewHuff @rchiodo, any thoughts?

@BenRussert , yes, inline results in the code editor. This requires changes in VS Code core.

NavyAdmiral commented 5 years ago

@BenRussert Actually with https://github.com/Microsoft/vscode/pull/66418 merged, vscode's exposed API should be enough now

stevenlis commented 5 years ago

hydrogen is really an amazing extension and I've been using it for anything: python, r, stata, and even julia recently😂... I really wish there could be a vscode version of it.

@ronglums The python extension is indeed amazing. any plan we can a jupyter interactive window so that it can support another language or something?

rchiodo commented 5 years ago

Python was the main language for datascience, but we plan on adding others in the future. You can vote on them here: https://github.com/microsoft/vscode-python/issues/5078

contang0 commented 5 years ago

@BenRussert , are there any plans for this now that the API seems to be exposed enough? I love Hydrogen, but Atom does not work behind many if not most corporate proxies, has been this way for a a couple of years now, and there are apparently no plans to fix it... meaning that I have to switch to VS Code.

wadethestealth commented 5 years ago

@joolius vscode-python is already popular and being maintained which is basically vscode hydrogen

contang0 commented 5 years ago

@joolius vscode-python is already popular and being maintained which is basically vscode hydrogen

They feel very different to me. vscode-python, at least currently, seems to be focused on just emulating jupyter inside of VS Code. You have to mark your code cells with "#%%", no way to print results inline (everything goes to output window, whereas I like to have two .py scripts open side by side and execute code inline, with no output window at all), cumbersome execution line-by-line. It may seem like little, but it feels very different if your workflow is very interactive, which is the case when doing data science.

Some competition is always good, too. :)

Just to be sure, vscode-python is already very good and probably satisfies most people's needs, but it does not cover what Hydrogen excels at - providing various productivity enhancements for highly interactive workflows.

wadethestealth commented 5 years ago

I think that it's just not the direction nteract is going. Hydrogen is an older now and most of nteract focuses on the desktop app. @joolius

ronglums commented 5 years ago

Thanks for your kind words for vscode-python! @wadethestealth @joolius The upcoming update will support an inline execution workflow for notebooks, which is much closer to the classic Jupyter style. hope that will help! :) https://twitter.com/davorabbit/status/1176314998806630400

wadethestealth commented 5 years ago

@ronglums no problem, and this is also very interesting news.

contang0 commented 5 years ago

@ronglums unfortunately for me, i'm not really looking for Jupyter style :(. Hydrogen uses jupyter under the hood, but offers a very different experience, that fits me much better when doing data science. Inline evaluation and not having to deal with code cells is what I'm looking for.

Atom has become completely unusable for me (apm is not working behind corporate proxies), so I have just moved to VSCode, but sticking to the terminal for now.

IDDT commented 4 years ago

I agree with @juliuscrn, Atom+Hydrogen is currently the no-alternative combo for interactive programming that is dissimilar to Jupyter Notebook cells approach. Inline execution allows even more rapid prototyping with the end result being a git-ready pure python script.

neo-anderson commented 4 years ago

Atom+Hydrogen made R Notebook style workflow possible for data scientists working with Python. You can quickly preview the document using any markdown preview tool and you can specify whether specific code chunks/output should be excluded from the final report, etc. It's unfortunate that this issue has been closed. Ironically, R Notebook now supports Python. So, anyone who wants that workflow could probably download R Studio and give it a shot!

contang0 commented 4 years ago

However, we also impose restrictions upon extensions to ensure the stability and performance of VS Code. For example, extensions cannot access the DOM of VS Code UI

Is this the reason why we don't have something like Hydrogen in VS Code yet?

https://code.visualstudio.com/api/extension-capabilities/overview

rchiodo commented 4 years ago

Is this the reason why we don't have something like Hydrogen in VS Code yet?

https://code.visualstudio.com/api/extension-capabilities/overview

Sort of I guess. That does it make it more difficult. Especially for our team (which doesn't own VS code itself).

However VS code's new notebook work may make this more possible in the future. They're inventing a way to ensure that the output cells can talk to each other but still be isolated from the DOM with your code in it.

Dvisacker commented 3 years ago

Just for information, the quokka vscode extension (https://quokkajs.com) does something similar to what hydrogen and the light table editor does. Unfortunately it's only javascript/typescript.

contang0 commented 3 years ago

Wolf (https://marketplace.visualstudio.com/items?itemName=traBpUkciP.wolf) shows that inline evaluation is possible. However, Wolf itself quite different from Hydrogen. You type code and after half a second it will evaluate the code whether you want that or not.

2sls commented 3 years ago

I would also love to see Hydrogen in vscode

While Jupyter support is pretty good (comparable to what you see in docker output) - having more kernel support would be great.

HenrikEckermann commented 2 years ago

Looking for alternative to Atom + Hydrogen, which to me was by far the best way to do data science in R or Python. Since I found that, I never looked for alternatives anymore. Now, years later, I have to look and am surprised that nobody copied that idea yet...Whichever editor can copy that will be my goto.

contang0 commented 2 years ago

There is nothing. Zed and Fleet are in their infancy and there's some hope that they will become something similar like Atom (although Fleet will probably follow Micro$oft in not allowing extensions to modify the UI in any meaningful way).

It's depressing. It feels like technology is regressing.

neo-anderson commented 1 year ago

@HenrikEckermann I started using R Studio+Python to generate reports and such! Python compatibility isn't bug-free and the editor isn't as powerful as VS Code/Atom, but the experience is better (to me) than going the Jupyter notebook route

oladimeji09 commented 1 year ago

+1

kylebarron commented 1 year ago

I wrote a quick extension for vscode a couple months ago that implemented "automatically inferring a Python code block" so that you don't have to select it manually (i.e. press Ctrl + Enter on the def line and it'll send the entire function definition to the interactive Jupyter session in the right pane), which was a very helpful feature of Hydrogen for me.

vscode's interactive Python support is still inferior to Hydrogen IMO, but at least that made it passable for me.

giancarloantonucci commented 12 months ago

+1