You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a public API to set the environment to a given path #16994
Originally posted by brettcannon June 16, 2021
I have an extension that currently changes the python executable being used by setting it in the user or workspace settings.json (depending how the user chooses to do it).
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 5 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.
Thank you to everyone who upvoted this issue! Since the community showed interest in this feature request we will leave this issue open as something to consider implementing at some point in the future.
We do encourage people to continue 👍 this issue as it helps us prioritize our work based on what the community seems to want the most.
The update is we have v1 of our read-only API designed, implemented, and we are starting to use it within the extension to make sure it works (the hope is to have this work done by our next release in February). We are then going to make sure first-party extensions have their needs met with the API. After that validation the API will go public be considered ready for use.
Once our public API has gone out we can discuss providing an API to allow other extensions to set the selected environment. We will very likely lean on the community for proposing a design, justifying it, etc. since we have no need for such an API.
Pinging here as we saw the Python iteration plan: #18214
So a couple of questions.
Seeing "Implement the proposed public API for the extension and use it internally vscode-python#17905" there and that related issue (#17905) is closed already, leads one to believe that at least some API already done, but is it coming out or..?
..if the plan is to remove the pythonPath support without anything in its place is a bit drastic as we would have to resort to guiding people on how-to copy&paste python paths.
So the other direct question is when is this release planned to happen that drops the experiment phase?
We are also trying to deduce another way based on this: https://github.com/microsoft/vscode-python/wiki/AB-Experiments#tldr
..so if we understand this correctly if we call Python: Clear Workspace Interpreter Setting and then set python.defaultInterpreterPath to point to the location of the python env. should that work?
Brett Cannon (@brettcannon) we have well over 1k active users building RPA bots with VS Code that really kind of depend on this, so I'd like to get ahead of the problem as much as possible 😅
Great we now have an implementation that uses the API if/when it exists and if not we call Python: Clear Workspace Interpreter Setting and then set python.defaultInterpreterPath way.
Thank you for this Karthik Nadig (@karthiknadig) !
Activity
brettcannon commentedon Sep 1, 2021
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 5 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.
brettcannon commentedon Oct 15, 2021
Thank you to everyone who upvoted this issue! Since the community showed interest in this feature request we will leave this issue open as something to consider implementing at some point in the future.
We do encourage people to continue 👍 this issue as it helps us prioritize our work based on what the community seems to want the most.
1 remaining item
brettcannon commentedon Jan 5, 2022
The update is we have v1 of our read-only API designed, implemented, and we are starting to use it within the extension to make sure it works (the hope is to have this work done by our next release in February). We are then going to make sure first-party extensions have their needs met with the API. After that validation the API will go public be considered ready for use.
Once our public API has gone out we can discuss providing an API to allow other extensions to set the selected environment. We will very likely lean on the community for proposing a design, justifying it, etc. since we have no need for such an API.
P.S.: I somewhat disagree with using that XKCD comic to prove a point. 😉
kariharju commentedon Jan 18, 2022
Pinging here as we saw the Python iteration plan: #18214
So a couple of questions.
Seeing "Implement the proposed public API for the extension and use it internally vscode-python#17905" there and that related issue (#17905) is closed already, leads one to believe that at least some API already done, but is it coming out or..?
..if the plan is to remove the pythonPath support without anything in its place is a bit drastic as we would have to resort to guiding people on how-to copy&paste python paths.
So the other direct question is when is this release planned to happen that drops the experiment phase?
We are also trying to deduce another way based on this: https://github.com/microsoft/vscode-python/wiki/AB-Experiments#tldr
..so if we understand this correctly if we call
Python: Clear Workspace Interpreter Settingand then setpython.defaultInterpreterPathto point to the location of the python env. should that work?Brett Cannon (@brettcannon) we have well over 1k active users building RPA bots with VS Code that really kind of depend on this, so I'd like to get ahead of the problem as much as possible 😅
karthiknadig commentedon Jan 18, 2022
Kari Harju (@kariharju) That (#17905) got closed by mistake. I am working on the proposed public API, I will post here when it is in.
karthiknadig commentedon Jan 19, 2022
Kari Harju (@kariharju) This is now in main. The API to set active python interpreter looks like this
vscode-python/src/client/apiTypes.ts
Line 149 in 262019b
karthiknadig commentedon Jan 19, 2022
This build has the
setActiveInterpreterAPI, please give it a try and let me know:https://github.com/microsoft/vscode-python/suites/4983385795/artifacts/145624970
kariharju commentedon Jan 19, 2022
Awesome!
We'll take a look and test.
kariharju commentedon Jan 21, 2022
Great we now have an implementation that uses the API if/when it exists and if not we call
Python: Clear Workspace Interpreter Settingand thenset python.defaultInterpreterPathway.Thank you for this Karthik Nadig (@karthiknadig) !
karrtikr commentedon Sep 26, 2022
Note API name is now changed, see https://github.com/microsoft/vscode-python/blob/main/src/client/proposedApiTypes.ts#L23
Feature (#19841) should be out in the pre-release version of the extension in a day, use the following to try it out: