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

Startup: "Forget" unused interpreters, or otherwise start them up less aggressively #3432

Closed
Tracked by #3541
jmcphers opened this issue Jun 6, 2024 · 3 comments
Closed
Tracked by #3541
Labels
area: core Issues related to Core category.

Comments

@jmcphers
Copy link
Collaborator

jmcphers commented Jun 6, 2024

Feedback from @nealrichardson:

I am working on an R package in Positron. There's no Python code in this directory anywhere, it's very clearly an R package. But when I open it in Positron, the Console tab is showing a Python interpreter running. I'm all for being Python first and all, but this seems excessive :)
Just to be sure, I just installed the latest Positron prerelease, and watched closely as the project opened. First it opened the Python repl, then it switched to the R console, and then after another little while, it switched back to Python

via https://positpbc.slack.com/archives/C05M2EZCPGR/p1716471902486219

This is emergent behavior resulting from two different Positron behaviors.

  • Python is started if nothing else seems appropriate (this probably happened at one point in the past in Neal's project)
  • We remember what was started and always start it again until you shut it down manually at some point

Both were intentional, but this emergent behavior isn't. We could help cut the chatter by:

  • automatically un-affiliating runtimes that don't actually get used (when there is a runtime that does get used), and/or
  • not creating an affiliation for a runtime that was only a guess

(Note that the switch-back-and-forth issue at startup is tracked separately, in #1143)

@jthomasmock
Copy link
Contributor

Somewhat related I think is: #4011 -- Sharon has a good suggestion there:

Perhaps a future enhancement to the new project flow is to ask the runtime service to make interpreter discovery of other languages opt-in. For example, for an R Project created via the Project Wizard, we wouldn't do Python interpreter discovery unless the user deliberately asks for Python interpreters through some UI affordance. Another thought is that we could ask the language extensions to do discovery "quietly" and not show notifications/errors unless the user is actively using that language.

@jmcphers
Copy link
Collaborator Author

First it opened the Python repl, then it switched to the R console, and then after another little while, it switched back to Python

This particular annoyance is addressed in #5959 (i.e. you should no longer see Python opening/starting in your R project unless you used it recently). This issue can now track the work to forget Python entirely if it is not used.

jmcphers added a commit that referenced this issue Jan 14, 2025
This change cause Positron to "forget" runtimes that are affiliated with
the workspace but that aren't actually used, with the goal of preventing
unwanted sessions from starting.

Some details:

- A runtime is considered to be unused if it was auto-started as an
affiliated runtime but then never actually used in the last session.
- The runtime affiliation is not wholly removed; we just stop
auto-starting it when Positron starts. So e.g. it is still consulted
when auto-starting a console in order to run code.
- This only applies to projects with multiple runtime affiliations. If
you only have one runtime affiliated, it will auto-start even if you
didn't use it in your last session.

Addresses #3432.

### Release Notes

#### New Features

- Do not auto-start interpreters that aren't being used in the workspace
(#3432)

#### Bug Fixes

- N/A


### QA Notes

For the purposes of this feature, a runtime is considered to have been
"used" if you switch to it in the Console.
@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2025.02.0-59
OS Version          : OSX

Test scenario(s)

Opened r_testing subproject of qa-example-content many times and the previously selected version of R became active each time.

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to Core category.
Projects
None yet
Development

No branches or pull requests

4 participants