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

Support fully integrated IPython terminal #22139

Open
ThomasA opened this issue Oct 3, 2023 · 17 comments
Open

Support fully integrated IPython terminal #22139

ThomasA opened this issue Oct 3, 2023 · 17 comments
Assignees
Labels
area-terminal community ask Feature request that the community expressed interest in feature-request Request for new features or functionality needs proposal Need to make some design decisions

Comments

@ThomasA
Copy link

ThomasA commented Oct 3, 2023

The Python IDE Spyder runs code in an IPython terminal integrated in the IDE. The IPython terminal opens along with the rest of the IDE and when you run a script, it gets run directly via %run in existing IPython terminal. The terminal remains open after execution of a script so that you can access variables in its context afterwards.
I sorely miss this feature in VSCode and it would be absolutely great if this could be offered by the Python extension. Spyder is open source, so it should be possible to see how they have implemented it.

@ThomasA ThomasA added the feature-request Request for new features or functionality label Oct 3, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 3, 2023
@karthiknadig karthiknadig changed the title Please make it possible to run code in fully integrated IPython terminal like Spyder does it Support fully integrated IPython terminal Oct 3, 2023
@karthiknadig karthiknadig added area-terminal needs community feedback Awaiting community feedback and removed triage-needed Needs assignment to the proper sub-team labels Oct 3, 2023
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

@cbrnr
Copy link

cbrnr commented Oct 25, 2023

See also #17172. I'd also like to be able to use IPython instead of the regular interactive Python interpreter.

@tomazfs
Copy link

tomazfs commented Nov 27, 2023

I'd also like to be able to use IPython instead of the regular interactive Python interpreter.
👍

@brettcannon
Copy link
Member

Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

@brettcannon brettcannon added community ask Feature request that the community expressed interest in needs proposal Need to make some design decisions and removed needs community feedback Awaiting community feedback labels Dec 7, 2023
@brettcannon
Copy link
Member

BTW please let us know what you specifically miss from IPython.

@m-ganko
Copy link

m-ganko commented Dec 7, 2023

Magic commands and colored input and output :)

@cbrnr
Copy link

cbrnr commented Dec 8, 2023

I'd also add the ability to run shell commands (e.g. !ls) as well as Matplotlib event loop integration via %matplotlib (very useful for interactive data analysis).

@jamesowers-cohere
Copy link

BTW please let us know what you specifically miss from IPython.

terminal functionality such as completions

@NedJWestern
Copy link

Ditto for syntax highlighting and code completions. If possible, it would also be amazing if ipdb was supported!

@jeremymatt
Copy link

I'm new to VSCode (coming here from Spyder because work uses VSCode), so apologies if these sorts of functionalities are available and I just haven't found them yet (and yes, I know that the debug console is a thing and some of the stuff I'm going to list can sort of be approximated in the debug console). Here's my list of the main things I find useful about the iPython console in Spyder:

  1. The ability to run a portion of my code (e.g., the part I've got working that loads in some data) and then have access to view & manipulate the namespace variables, test lines of code, etc. This is one of the things the debug console can approximate, but you don't have to keep mucking around with setting/clearing breakpoints.
  2. The ability to run multi-line code snippets (e.g., a for loop). I haven't been able to get this to work in the debug console
  3. using ? to open up a functions docstring (e.g., running np.random.random? or pd.DataFrame? in the iPython console) can be a much quicker way to get basic documentation

@brettcannon
Copy link
Member

2. The ability to run multi-line code snippets (e.g., a for loop). I haven't been able to get this to work in the debug console

That won't work as it isn't designed for that. Are you not using our REPL support, which supports sending multi-line code, because it lacks a variable viewer?

@jeremymatt
Copy link

  1. The ability to run multi-line code snippets (e.g., a for loop). I haven't been able to get this to work in the debug console
    That won't work as it isn't designed for that. Are you not using our REPL support, which supports sending multi-line code, because it lacks a variable viewer?

@brettcannon Thanks for the response. To be honest, I'm very new to VSCode, so I wasn't aware that REPL support was a thing. But yes, the lack of a variable viewer would be somewhat annoying.

@copdips
Copy link

copdips commented Nov 10, 2024

hello @brettcannon,

My use case for IPython is launching a debug session with IPython. The Databricks VSCode extension adds an IPython startup script that sets some environment variables and initializes a Spark session.

However, when using the default VSCode Python debugger, which is a standard Python interpreter rather than the IPython one, the IPython startup script is not executed.

I tried this config in launch.json, but it doesn't wok:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "IPython Debugger: Current File",
      "type": "debugpy",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "python": "${workspaceFolder}/.venv/bin/ipython"
    }
  ]
}

@brettcannon
Copy link
Member

/cc @anthonykim1

@anthonykim1 anthonykim1 self-assigned this Dec 10, 2024
@anthonykim1
Copy link

Thanks everyone for showing interest in this.

As I mentioned #17172 (comment), I'd like to know what folks think about the new Native REPL and get some feedback on what specific features folks really want from iPython in terminal.
Thank you in advance for your opinions.

@cbrnr
Copy link

cbrnr commented Dec 11, 2024

I have to say that I stopped using IPython, because the new REPL in Python 3.13 is good enough for me. I'd prefer using that over the Native REPL, since a terminal-based REPL has been the go-to method for interactive computing for me, as it is also available in many other languages. Therefore, I'd rather have a good terminal REPL experience than a custom "native" REPL (but unfortunately there are still a couple of issues, such as the indentation issue on Windows, the fact that running the entire script and running single lines/selections in the REPL use the same terminal, etc.).

@hoechenberger
Copy link

hoechenberger commented Dec 11, 2024

Thanks @anthonykim1 for asking about this!

This might be slightly off-topic but I wanted to say that I'm still struggling to understand the motivation behind the native REPL.

I've been a VS Code Python user for many years, and I have two distinct use cases for running my code:

  • interactive, which involves (re)running code segments individually and generating static or interactive figures
  • non-interactive: an entire script runs completely from beginning to end and then exits

The first case is already covered through using code cells together with the Interactive Python window.

The second case is covered by the Run button, which spawns a Python interpreter on the command line and runs my code.

I don't understand which use case the native REPL is addressing -- maybe because I'm not in the target audience? What's the goal here? I see it can spawn an interactive-window-like experience without requiring a Jupyter kernel, but I don't see how this brings me any advantages either? I've got plenty of SSD storage, and dev-only dependencies (for interactive development) are declared as such, so they won't get deployed after development has been finished and we go into production.

Would you be so kind as to help me understand what the native REPL is all about? I know for a fact that several of my friends and colleagues -- all faithful users of VS Code for many years now!! -- feel the same: they're confused and hence don't use the native REPL at all so far.

Thank you so much for your input!

Richard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-terminal community ask Feature request that the community expressed interest in feature-request Request for new features or functionality needs proposal Need to make some design decisions
Projects
None yet
Development

No branches or pull requests