positron icon indicating copy to clipboard operation
positron copied to clipboard

Shared kernel for Jupyter Notebook and console

Open AJajodia opened this issue 2 years ago • 8 comments

It would be nice to have the ability to interact with Jupyter Notebook variables from the console, similar to how users can tinker with variables in .Rmd files from the R console. This functionality exists in a similar capacity in Qtconsole and by manually connecting to kernel instances, but it would be a great built-in feature.

Discussion can be found here https://github.com/posit-dev/positron/discussions/3766

AJajodia avatar Jul 02 '24 10:07 AJajodia

This feature is very much needed. If I highlight some part of the code, right click and choose Run Python -> Run Python in console, it will not work as they are not sharing the same kernel

ntluong95 avatar Jul 02 '24 13:07 ntluong95

As an observation, this is kind of like the opposite of the request for Quarto files to have inline, notebook-like execution.

Related to #1533

juliasilge avatar Jul 02 '24 14:07 juliasilge

For me its not the something a bit orthogonal rather; https://github.com/posit-dev/positron/issues/1533 is discussing where to plot/display the output of the cell execution of notebook connected to kernel; This issue is discussing rather having an additional way to input/interact with the kernel;

This should be option to configure, perhaps not by default (or just user can open an console connected to the current running kernel in the notebook) ; sometimes I very need the input inline in the notebook, sometimes would be create to print/test something without adding and removing code in the notebook

danieltomasz avatar Aug 02 '24 19:08 danieltomasz

+1 for this feature request.

I became aware of Positron by people essentially calling it RStudio for both R and Python (regardless of whether this is how the Positron team wants to advertise the IDE as), so my expectation as a first-time user is that my RStudio workflow would be able to carry over to using Python in Positron.

My typical RStudio workflow involves creating a .Rmd script and interactively playing around with my variables in the R console pane. Would really like the ability to do the same with a .ipynb jupyter notebook and a Python (or Jupyter) console.

One might counter and say, "why don't you just quickly create a new jupyter cell, execute whatever code you wanted to, and delete the cell afterwards?". Sure, I could do this and it isn't the end of the world, but again coming from an RStudio experience, it feels pretty cumbersome, inefficient, and clunky to do that. Not to mention the annoyance of jupyter cells truncating the inline outputs, whereas in RStudio, the R console can handle outputs of hundreds of lines long (I think by default it's set at 1000 lines)

Without this feature, personally I don't see a particular advantage to using Positron over other IDEs like VS Code (minus the effort of 1 extra click on my mac toolbar to open up VS Code) for data analysis work using Jupyter notebooks. BTW, this is also a missing feature in VS Code that many of their users have been asking for years now (see here for ex: https://github.com/microsoft/vscode-jupyter/issues/4573).

chrishklee avatar Jul 14 '25 01:07 chrishklee

Verified Fixed

Positron Version(s) : 2025.10.0-170
OS Version          : OSX

Test scenario(s)

Verified with spotify.ipynb in qa-example-content

Link(s) to TestRail test cases run or created:

testlabauto avatar Oct 01 '25 22:10 testlabauto

This is implemented now. Every notebook gets its own console, which is bound to the same kernel as the notebook; it is hidden by default, but you can show it by using the Notebook: Show Notebook Console command or by selecting the Show Notebook Console menu entry here:

Image

You can just type stuff in the console, of course, but you can also use it to evaluate portions of cells by highlighting the portion you want to run and using the Notebook: Execute Selection in Console command, or this menu item:

Image

jmcphers avatar Oct 02 '25 17:10 jmcphers

the execute selection in console is so helpful and is the thing I am looking for. Very handy to testing where of course cell output will be the thing printed for the execution of whole cell

ntluong95 avatar Oct 02 '25 17:10 ntluong95

Notebook Console Actions Now Opt-In

Hey folks! We've made this notebook console work an opt-in feature for now based on feedback in #9948.

What's new:

  • Added a new setting Console: Show Notebook Console Actions (console.showNotebookConsoleActions) that controls whether the "Show Notebook Console" and "Execute Selection in Console " commands appear in your notebook toolbar/menu/command palette. It's off by default to keep the UI clean while we refine the experience.

The existing Console: Show Notebook Consoles (console.showNotebookConsoles) setting hasn't changed and still controls whether consoles are automatically created when you open a notebook.

These two settings are independent, so you can mix and match based on your workflow:

  • Turn on Console: Show Notebook Console Actions to manually show consoles when you need them
  • Turn on Console: Show Notebook Consoles if you want consoles for all notebooks without the extra toolbar buttons
  • Turn on both if you want all the options!

Both settings are experimental for now as we gather feedback and refine the experience.

dhruvisompura avatar Dec 13 '25 01:12 dhruvisompura