-
Notifications
You must be signed in to change notification settings - Fork 1.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
Improve compatibility and consistency between Python REPL and terminal commands in the Command Palette #22970
Comments
Hi @raphaelchinchilla Thank you much for the bug report and suggestion on better integration across different ways of triggering REPL. I agree that there should be more unified experience in regards to In terms of native IPython support, we do not have plan to ship IPython in box for multiple reason including the size of it and existence of interactive window. See related here: #17172 and #19955 Good news is there is investigation for VS Code Native REPL that will provide some of the main features that people have been desiring such as autocomplete, syntax highlighting, command history. This native REPL will potentially be able to leverage Jupyter's variable viewer feature that is behind notebook at the current moment. In terms of variable explorer, Jupyter extension just launched a variable viewer that nicely goes on the side var that you can check it out if you wish. Is there any specific reason for your preference towards IPython? I would love to take some of the nice things that attracted you with IPython and Spyder's interactive mode. |
Thank you @anthonykim1 for taking the time to look at this.
It is a shame to hear that. I will go on later in why I don't like the interactive window.
This sounds promising, interested to see what it happens out of it.
For me, IPython is better than the regular Python REPL as it supports all of the magic commands. But a particular application that I really like about IPython is that I can just go to my code and set a breakpoint by writing VS Code's Interactive Mode is similar enough to Spyder that I use it when I need to use Python on VS Code. However, it has the fundamental flaw that one cannot use it for debugging microsoft/vscode-jupyter#1278. This might be solved one day but as it has been almost 5 years and there is no solution yet, I figured I might just use IPython. I believe that the fundamental flaw is that ipykernels do not seem to work very well with debugging pipelines. Writing Anyway, if these would be fixed by VS Code's REPL (which if I understand well, will be different than the Interactive Mode), then great. Otherwise, I would rather just continue to use IPython and have a nice way to start a kernel... |
Hey @anthonykim1, this issue might need further attention. @raphaelchinchilla, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. Happy Coding! |
TLDR: Streamline the Python REPL experience by unifying REPL and terminal commands, and adding customization options for IPython integration.
(This is a mix of feature request and bug report)
Suppose one has a python script open.
There are (at least) three methods to use a "vanilla python interface" (not using the Interactive Mode or the Debugger) using the Command Palette:
Python: Run File in Terminal
.Python: Run Selection/Line in Terminal
(which has the default shortcut commandShift+Enter
).Python: Start REPL
and then copy and paste the code.Unfortunately, none of these commands seems to be compatible with each other in several ways:
Python: Start REPL
and then selects part of the script and runsPython: Run Selection/Line in Terminal
(or use the keyboard shortcut), it creates a new terminal instead of opening in the current REPL.Python: Run File in Terminal
Python: Run Selection/Line in Terminal
and then selectsPython: Run File in Terminal
, one gets an error as the IDE tries to run/path/to/python/bin "/path/to/file"
inside the Python terminal, which obviously does not work.Python: Run Selection/Line in Terminal
without actually selecting a code and running it.My suggestion is to clean up all of these commands: The command
Python: Start REPL
should start the same REPL as the one started withPython: Run Selection/Line in Terminal
. The commandPython: Run File in Terminal
should run the code in the REPL if it is open, and to run in a new REPL, the command should be thePython: Run File in Dedicated Terminal
. Running the commandPython: Start REPL
several times should create new REPLs, so the code can be run in different ones.A bonus would be that the REPL is chosen to be IPython if the user wants. This is already possible by modifying the settings.json and including the entry
but it would be better if this has some more support, including have custom launch arguments to be able to include
%load_ext autoreload \n %autoreload 2
The issue #22674 is already acknowledging that there are a lot of people in the community (like me) asking for a better REPL experience, with a variable explorer and a plots plane, like the Julia extension or Spyder (and that is not based on the Interactive Mode, which has several issues). While I agree that it would be great if these features were made available, I think that what I report above would be an easier fix and also a first step in the right direction.
Finally, I know that there are some extensions that are supposed to provide IPython integration. However, these are small projects, several of them seem to be effectively abandoned. At least one is in current development, but seems to be a one person effort. Moreover, any extension does not fix the issues above and only creates yet another method to run python files.
The text was updated successfully, but these errors were encountered: