posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.76k stars 82 forks source link

Exclude interpreter discovery for languages not used in new project #4011

Open mine-cetinkaya-rundel opened 3 months ago

mine-cetinkaya-rundel commented 3 months ago

Positron Version:

2024.07.0 (Universal) build 41

Steps to reproduce the issue:

  1. New > New Project...
  2. Select R Project and then Next
  3. Keep the default name or change the name (I tried both) and use the default path or change the path (I also tried both)
  4. Do not select "Use renv to create a reproducible environment"
  5. Open in new window

Two issues arise:

Screenshot 2024-07-14 at 1 19 41 PM

What did you expect to happen?

I did not expect Positron to look for Python interpreters since I started an R project.

Were there any error messages in the output or Developer Tools console?

In the Developer Tools console:

workbench.desktop.main.js:245250 The entered path does not exist:  /Users/mine/Desktop/myPythonProject/.venv/bin/python

I can't tell if this is related to #3339, but it is the same error.

sharon-wang commented 3 months ago

Thank you for the super clear issue notes!

I was able to reproduce with a combination of your steps and the steps from the other issue you mentioned. Creating the project is successful (the expected files are created and the selected runtime is activated), but the Python extension error notifications show. It does look like the same error as #3339 to me as well, so I've posted my repro notes over there.

Although we prioritize starting the interpreter chosen in the Project Wizard, our runtime startup process will still proceed with the usual interpreter discovery. I think https://github.com/posit-dev/positron/issues/3575 tracks adding the ability to skip/disable discovery of specific languages.

In the meantime, if you're not an active Python user, you could disable the Python extension to skip Python runtime discovery in general, noted by Jonathan: https://github.com/posit-dev/positron/issues/3575#issuecomment-2176591849.

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.

sharon-wang commented 3 months ago

If it makes sense to you too, I'll change this issue into an enhancement regarding skipping discovery of non-relevant language runtimes when creating a new project, with the bug part of this issue captured in #3339.

mine-cetinkaya-rundel commented 3 months ago

@sharon-wang That makes sense to me.

I am an active user of both languages, so I don't want to disable one, but thanks for that pointer nonetheless.

However, if such a thing is offered as an "R project," there should be no discovery for other languages, or at least, it should be quiet. An R-only user shouldn't feel like they need to have Python installed to use Positron and vice versa.

Another idea is to have a multi-language project type being offered, and then discovery can happen for both languages, and errors around those wouldn't seem out of place.