vscodeJupyter
vscodeJupyter copied to clipboard
feature request: support IPython console
From @mickeydonkey on November 3, 2016 2:6
Dear developer of pythonVSCode:
IMHO current IPython integration #303 is like a variation of jupyter notebook. While IPython console is a popular REPL mode which arms user with convenient magic commands. To enter IPython console, one just types 'ipython' in terminal. It'll be great to see functionality like:
- simply "python: run selection in ipython console"
- running a code cell in the IPython console and display its output in parallel;
Thanks
Copied from original issue: DonJayamanne/pythonVSCode#480
From @mickeydonkey on November 3, 2016 5:7
IPython Qtconsole is more powerful than plain IPython console in terminal. An app that embeds IPython QTconsole is spyder-ide, I'm not sure If it can be embeded in vscode though.
@mickeydonkey Embedding the QTconsole into VS Code wouldn't be possible. However we could build something similar. But the question is, how many people would want such a feature in VS Code? Up votes to this issue will tell us.
From @gandhis1 on November 3, 2016 21:9
@mickeydonkey , What benefit do you see in using IPython console instead of the Jupyter notebook kernel? To me, having both features is redundant. You can run magic commands in Jupyter, and you can also run selections in Jupyter.
From @mickeydonkey on November 5, 2016 6:36
@gandhis1 Thanks for your interest. Yes, IPython console, IPython QTconsole and Jupyter notebook all provide some functionalities in common, like the magic commands you mentioned. that is because of the IPython kernel they are all connected to. IPython console or the improved counterpart - IPython QTconsole- is not the reinvented wheel compared to jupyter notebook.
To me IPython console is more like the under-the-hood mode of IPython kernel, all user codes history in the IPython kernel are recorded and displayed in the console so I can see the order in which my code inputs were ran. By pressing upper-arrow key I can easily call the code in history and make some modification based on that. But when it comes notebook, code cell are overwritten when I modify existing code cells and the order of cells are not that easy to figure out. That is especially true when your task involves lots of small try-and-error experiments before you finally know how to do the job correctly. I am more comfortable with shell-like convenience, In fact Most of time Qtconsole's image-display feature can make me happy and I only resort to notebook when I need fancier data visualization functionality for data-presentation purpose.
IPython console can also be used as a debug console as the PyCharm IDE already supported. When the program stops at one breakpoint, I can explore with IPython console's functionality. For debugging data science programs like data wrangling, Traditional watch list approach is not good for watching data tables, It could be a huge benefit if we can display some inline image to inspect the on-the-fly status of our "tables". Actually a friend of mine who comes from MATLAB world have complained to me the lack of similar feature in Python world.
Finally, I've tried several IDEs and found out no perfect one for data science project. Either weak in debug, visualization or interactivity. As VS Code use the web-technology like RStudio, more possibilities are open. I am looking forward to seeing VS Code growing into the de facto data science IDE for python. BTW, another promising one is Atom except it's sluggish.
From @martinfiers on November 12, 2016 14:55
I would also like to vote for this feature. My main usage would be to run small try-and-error experiments without having to leave the editor environment. Secondly, I'd use it to run small pieces from selection or from a code cell; inspect the results, experiment with some list comprehensions based on the available variables, etc, in a REPL fashion. So quite similar to what @mickeydonkey explains.
Resetting the console would be quite important, especially when the applications you're debugging are very stateful.
From @Twizzledrizzle on December 4, 2016 9:30
Also interested in this! Currently testing with running ipython in the debug console instead
From @gandhis1 on December 9, 2016 22:18
I have a few additional thoughts on this. There are currently a couple of actions that can be performed in the editor, "Run Python File in Terminal" and "Run Selection in Python Terminal". What if a setting was added which allows one to use iPython Console instead of a regular Python Terminal, and then executing code in the terminal operated off of this?
From @jruizaranguren on December 29, 2016 17:32
This can be done just by changing the pythonpath setting in the workspace settings (or alternatively in the user settings). For instance, if you have installed Anaconda:
{
"python.pythonPath": "D:/Anaconda/Scripts/ipython3.exe"
}
From @gandhis1 on January 3, 2017 15:57
If I am running an application stand-alone, of course I want to use the regular Python interpreter, which is more lightweight and has faster startup time. Only if I want to be doing interactive stuff do I want to be using IPython. To use the same for both would not be ideal.
+1 this is a must. I completely agree with @mickeydonkey
I also would love to have that feature! I think a lot of people working on data science related topics are having the same workflow described by @mickeydonkey
I very much like the REPL style development with IPython console. The best part is auto-complete of live variables. It would be great to get support for this, pretty much as how @mickeydonkey described. Thanks!
+1 for the reasons described above.
+1 Before using VS Code, I always had Notepad++ and Jupyter QTConsole on either side of my screen to do the REPL work space. Having them in the same program and even have some better interactivity would be fantastic.
+1 This feature probably is the last thing that prevents me from migrating completely to VScode.
+1 for the reasons of debug.
Me too. Main reason that's preventing me from changing from Spyder + GitHub Desktop to VS Code.
+1 for the debugging capabilities!
@ftpronk @yehoshuadimarsky @Louis-udm @chenwang @u2berggeist @somelinguist @caesar, @surelyourejoking, @yehoshuadimarsky, @shelper, @nunobbras, @johnnadratowski, @Louis-udm @benjello @nunobbras, @rathsandeep, @wdscxsj, @johnnadratowski, @u2berggeist, @Louis-udm, @benjello @vograno, @pabloazurduy, @riccardo-gallini, @rathsandeep, and @ftpronk
Please could you vote 👍 (if you haven't) on the top comment (https://github.com/DonJayamanne/vscodeJupyter/issues/19#issue-213049637), this way its easier to capture the total number of votes on this issue. Thanks
Really want this
@troflog Please 👍 on the very first comment so we can keep track of total votes on this issue.
@DonJayamanne The accumualted 👍s of this issue reveals abundant demand, In hope of official support from Microsoft, I post an feature request on (https://github.com/Microsoft/vscode-python/issues/727) .
@DonJayamanne sorry, I got a bit lost in this thread and want to know if you managed to set ipython as the debug console in VS Code in the end or if this is still a desired feature? I tried to add the below to my config file but got no luck:
{
"name": "ipython",
"type": "python",
"request": "launch",
"program": "${file}",
"pythonPath": "/Users/tsando/anaconda3/bin/ipython"
}
What this does is that it launches the the program from the integrated terminal using ipython,
but the debug console is still not ipython clearly, as when I try to look at the head of a pandas dataframe, it gives the output in the wrong way - see screenshot below
Do you have any ideas or managed to figure how to get ipython in the debug console? Thanks!
I created a small extension to add this feature, while we wait for an official implementation from Microsoft. https://marketplace.visualstudio.com/items?itemName=pancho111203.vscode-ipython
It basically adds two commands:
- ipython.sendFileContentsToIPython - send whole file to ipython
- ipython.sendSelectedToIPython - send selected lines (or current)
If you find any issues with it, please post them here: https://github.com/pancho111203/vscode-ipython/issues
@pancho111203 thanks, but does this extension work also in debug mode? i.e. when i debug, is the debug console an ipython console? thanks.
@tsando No, it doesn't. I could add the ability to use breakpoints but I don't see the point. In my opinion the debugger vscode provides works perfectly for that use case.
@pancho111203 but i thought the point of this thread was to address that... i don't think the VS Code debugger is very friendly visually when it comes to debug python as PyCharm is. For example, when examining pandas dataframes, e.g. df.head()
, the VS Code debugger shows a nasty print style, with no line breaks as follows:
whereas in Pycharm debug mode, it uses the ipython console, so you can see the df nicely, and also use the tab autocomplete functionality of ipython, as well as all the magic functions, and plotting. This is how it looks in PyCharm:
Upvoted. I also believe that IPython console is an essential component of a Python IDE.
Upvoted. Having the code editor and the ipython console side by side (horizontally) is very useful for scientific computing, and is in fact what Spyder has been using. (Having just a plain Python console isn't quite enough because we often need to do quick visualizations in the console.)
I totally agree when doing any type of scientific computing there are two additions needed ipython console and variable explorer this would boost the use of vs code python significantly