Skip to content

Respect quarto.cells.useReticulate setting in Positron - #1116

Merged
juliasilge merged 2 commits into
mainfrom
respect-reticulate-setting-on-positron
Sep 9, 2026
Merged

Respect quarto.cells.useReticulate setting in Positron#1116
juliasilge merged 2 commits into
mainfrom
respect-reticulate-setting-on-positron

Conversation

@juliasilge

@juliasilge juliasilge commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Addresses posit-dev/positron#6675 in part

This PR fixes a bug in Positron. Before this change, Positron ignored the quarto.cells.useReticulate setting. When you ran a Python cell in a document with engine: knitr, Positron always rewrote the code to run in the R console through reticulate::repl_python(...). The setting had no effect. Now the Positron cell execution path checks the same setting that the default VS Code host already uses.

I also added a regression test. The test runs a knitr Python cell with the setting off. It shows that the cell executes in the Python console instead of R.

Known limitation

This change does not solve the full problem in the issue about the difference between running a statement and Run Cell. In Positron, Cmd+Enter (run the current statement) sends the command to Positron core's positron.executeCodeFromPosition command. This command always runs Python cells on the Python console. It does not check the quarto.cells.useReticulate setting, and this extension has no hook to change that path. As a result, with the setting on, Run Cell now goes to R through reticulate, but Run Line still goes to Python. A fix for that part of the issue needs a change in Positron itself.

Validation steps

  • yarn test-positron passes (includes the new test)

  • With a .qmd file that has both an r chunk and a python chunk:

    • With the setting on (the default), running a knitr Python cell with Cmd+Shift+Enter runs it via R through reticulate:
Screenshot 2026-09-08 at 3 55 54 PM
  • With the setting off, the same cell runs directly in the Python console:
Screenshot 2026-09-08 at 4 04 24 PM
  • R cells run the same way, with the setting on or off

  • Switching the setting on and off again repeats this same behavior each time

@posit-snyk-bot

posit-snyk-bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@vezwork vezwork left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change is simple and good. Tested in Positron daily confirmed that by default (when the useReticulate setting is on) python cells in a qmd with an r cell get sent to the r console with reticulate. When the setting is off, they get sent to the python console.

Looking forward to command+enter being fixed to respect the setting as well.

@juliasilge
juliasilge merged commit 9778c2b into main Sep 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants