microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 293 forks source link

Be able to specify `Smart Send` to use IPython #15988

Open anandijain opened 8 months ago

anandijain commented 8 months ago

It'd be nice if I could use IPython instead of vanilla python repl with smart send. other than that it is an amazing and crucial feature - Thanks!

anthonykim1 commented 8 months ago

Hello @anandijain Thank you for the feature request, and the compliment! Is there any reason that you favor IPython? We are in a process of investigating and thinking about VS Code native REPL experience here: https://github.com/microsoft/vscode-python/issues/22674 and https://github.com/microsoft/vscode-python/issues/23029 but would love more of your feedback on why you prefer IPython.

wagnerlmichael commented 7 months ago

I stumbled onto this thread and I think this would be a great addition if it ends up making sense. I may not be understanding correctly, but iPython has things like tab completion, history, etc. Perhaps these additional features are what @anandijain was referencing?

github-actions[bot] commented 5 months ago

Hey @anthonykim1, this issue might need further attention.

@anandijain, you can help us out by closing this issue if the problem no longer exists, or adding more information.

LarryLegend33 commented 5 months ago

Hi @anthonykim1 we are alll using vscode in our group, coding jax. All of us use jupyter in our interactive sessions, and having smart send for jupyter would be a major benefit.

anthonykim1 commented 4 months ago

Thank you all for the feedback! With the experimental setting VS Code native REPL, you will be able to get features like Intellisense, syntax highlighting for running Python code. Please give this a try available in insiders. Let me know if the new REPL lacks in some features you are looking forward to in a REPL experience. Would love to have that on the action item to work on in the future.

To enable this feature: you may click on setting and type 'repl' or add: "python.REPL.sendToNativeREPL": true, to your settings.json. For the best experience, please also add "interactiveWindow.executeWithShiftEnter": false, to your settings.json. This will closely replicate how Python's interactive interpreter behaves and will smartly execute or wait for you to type "complete" Python code.

Also strongly agree with the smart send. Not exactly with IPython but we are working to get it working with the native REPL that just got shipped last month: https://github.com/microsoft/vscode-python/issues/23521

TraceBivens commented 4 months ago

I just installed the newest update and was excited to try the native REPL + smart send and was immediately disappointed to discover that it doesn't work with my conda environments. For me at least, the ideal behavior would be for smart send to either send to my currently active terminal OR to detect the currently active environment in that terminal and then use that kernel.

anthonykim1 commented 3 months ago

@TraceBivens Hello! Thanks for trying out the native REPL along with smart send.

You are right that the ideal behavior should be us respecting your most recently activated environment as a dedicated kernel/engine for Python REPL. Does this behavior persist when you "Python: Clear cache and reload" on command palette? Try exiting out the already existing REPL tab and see if launching a new one will pick the desired interpreter option for you. If problem persist, please feel free to file as a github issue in our repository so we can track it there.

bnarum commented 3 months ago

Hello @anandijain Thank you for the feature request, and the compliment! Is there any reason that you favor IPython? We are in a process of investigating and thinking about VS Code native REPL experience here: microsoft/vscode-python#22674 and microsoft/vscode-python#23029 but would love more of your feedback on why you prefer IPython.

For me, I found this issue because I was looking for the ability to view tabular data in “Data Wrangler”, variable inspection and viewing plots. These are supported in Jupyter but “Smart send” is much better than having to type out Jupyter cells explicitly.

These features are well implemented in the julia-vscode extension, so I would suggest looking at how the repl interaction is implemented there for some inspiration.

hutch3232 commented 3 months ago

I came here looking to make this same request. I hadn't heard of the native REPL before seeing this thread. I'm using VS Code 1.92.0 and the native REPL is working great with smart send. I like that it doesn't require the Jupyter extension or the ipykernel package and all of its dependencies. It keeps my project setup/dependencies simple and minimal. Thanks for this addition!

I am seeing one quirk with it though: when I do shift+enter on a line/block of code, it sends it to the native REPL but then my cursor is automatically moved to the REPL's text input window. I would much prefer it to jump ahead to the next line of runnable (i.e., skip comments) code. Then I can spam shift+enter to progress through my script interactively.

bnarum commented 3 months ago

I am seeing one quirk with it though: when I do shift+enter on a line/block of code, it sends it to the native REPL but then my cursor is automatically moved to the REPL's text input window. I would much prefer it to jump ahead to the next line of runnable (i.e., skip comments) code. Then I can spam shift+enter to progress through my script interactively.

This has been requested already. Please give this feature request a thumb up: https://github.com/microsoft/vscode-python/issues/23843

github-actions[bot] commented 2 months ago

Hey @anthonykim1, this issue might need further attention.

@anandijain, you can help us out by closing this issue if the problem no longer exists, or adding more information.

anthonykim1 commented 2 months ago

I'm transferring this feature request to Jupyter extension. I think smart send inside notebook cell can be great addition! /cc @amunger @rebornix

andredmoliveira commented 1 month ago

Hi @anthonykim1 ! I was looking for something similar and found this thread. It would be great to have the exact same behaviour when shit + enter to terminal "python.REPL.enableREPLSmartSend": true applicable to both Jupyter interactive window"jupyter.interactiveWindow.textEditor.executeSelection": true or Python Native REPL"python.REPL.sendToNativeREPL": true

anthonykim1 commented 1 month ago

Hello @andredmoliveira ! I'm super glad you are liking Smart Send feature :)

You should be able to use smart send with the native repl. Reference: https://github.com/microsoft/vscode-python/issues/23521 I believe all you need to do is specify both smart send and native setting to be true. (Make sure you check both user and workspace setting so you don't unintentionally override your intended behavior)

Having upvotes on this issue/request would probably get us more support for smart send with "jupyter.interactiveWindow.textEditor.executeSelection": true though.

SamuelAllain commented 1 month ago

Thanks @anthonykim1 for your replies and work. The problem with the native REPL is that it lacks several features as of now. The most important for me are :