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

Look into ways to automatically select environment without specifying python.pythonPath #2126

Closed
brettcannon opened this issue Jul 10, 2018 · 11 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality needs proposal Need to make some design decisions

Comments

@brettcannon
Copy link
Member

Basically VS Code's design of having only global and workspace settings means there is no concept of a machine-specific setting when teams standardize on a workspace settings.json. That means we should look at ways to let people either specify the exact way they want their environment to be selected without specifying an absolute path or scale back when we write python.pythonPath to settings.json.

One key thing to keep in mind is that environment discovery can be expensive, so we may need to come up with a solution where people can say, e.g. python.usePipenv or something so we know to short-circuit searching in other ways and only use pipenv.

@brettcannon brettcannon added feature-request Request for new features or functionality needs decision labels Jul 10, 2018
@brettcannon
Copy link
Member Author

This came up in #2125 . This might only apply in situations specifically like pipenv where teams will standardize around a tool like pipenv which will keep the virtual environment outside of the workspace.

@brettcannon brettcannon changed the title Look into ways to select environment without specifying python.pythonPath Look into ways to automatically select environment without specifying python.pythonPath Jul 11, 2018
@DonJayamanne
Copy link

See comments here #2125 (comment)

Summary:

  • Complicated (not sure whether this is worth the engineering effort)
  • Should wait for VSC to come up with an alternate config system

@DonJayamanne
Copy link

DonJayamanne commented Aug 2, 2018

(not sure whether this is worth the engineering effort)

I take that back, guess that what needs to be determined and decided. Sorry. I guess we'll need to first come up with some solution and the make the decision.

@brettcannon brettcannon added needs proposal Need to make some design decisions and removed needs decision labels Aug 29, 2018
@brettcannon

This comment has been minimized.

@DonJayamanne
Copy link

DonJayamanne commented Sep 22, 2018

also realized we need a solution for the fact that virtual environments have different paths on Windows compared to UNIX (i.e. .venv/Scripts/python versus .venv/bin/python). That alone prevents teams from checking in their

This is already supported, been there from day 1. Added to support exactly the scenario you have mentioned.

@eirannejad
Copy link

Thank you all for the feedback on this. I'm not fully understanding the challenges behind this but it seems like in most cases, a python project has a venv associated with it so in most cases VSC can just ask the venv manager e.g.pipenv --venv for the python path. In all other cases it can ask the user for the project python path. In either case, the path should not be saved in workspace settings.json. I'd appreciate any help on understanding the issue better. Thanks!

@brettcannon
Copy link
Member Author

@eirannejad not everyone uses a environment management tool, so there's subtly there. Otherwise explaining is premature as we have not taken the time to write out our own design for the solution yet.

@gramster gramster added area-environments Features relating to handling interpreter environments and removed area-environments Features relating to handling interpreter environments feature-interpreter labels Oct 10, 2019
@brettcannon
Copy link
Member Author

#7805 will implicitly take care of this.

@ievgennaida
Copy link

same problem

@Arcitec
Copy link

Arcitec commented Jan 27, 2022

@brettcannon This can be closed. I'm on the latest VSCode and latest vscode-python extension. It properly auto-detects the Pipfile in my project folder and auto-selects the correct virtualenv Python interpreter path. No need to touch the pythonPath at all.

@brettcannon
Copy link
Member Author

@Bananaman thanks for letting us know about this rather stale issue. 😅

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality needs proposal Need to make some design decisions
Projects
None yet
Development

No branches or pull requests

8 participants