-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Select pyenv environment based on folder .python-version file #1167
Comments
https://github.com/pyenv/pyenv#choosing-the-python-version has the specification on how pyenv chooses an interpreter by default. I think detecting the file and using it as appropriate seems like a sensible enhancement (maybe even the file traversal to the parent directory, but not as sure on that one). |
@brettcannon I'm not sure if it's possible but you should be able to let pyenv do the heavy lifting if you use the shims it provides as the interpreter, as long as its run in a context (i.e. directory) aware way. |
Hi @brettcannon, will this issue be addressed in any near future? Thanks! |
@eugenweissbart sorry, we don't give ETAs since they always turn out to be wrong. 😉 |
Would like to see this feature as well. |
@djdembeck please make sure to upvote the opening comment as that's how we determine community interest. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Spike resultsCouple ways to go about it:
To avoid relying on internal details of pyenv and keep things simple, approach 2 sounds reasonable. Tested |
Environment data
Actual behavior
You have to manually select the pyenv interpreter for each workspace folder.
Expected behavior
It should detect the workspace pyenv interpreter based on the
.python-version
file present in the workspace folder root.For example, every folder I have added to my workspace has a
.python-version
file that pyenv creates when you runpyenv local NAME_OF_VENV
in that folder. The file contains a single string which is the name of the folder/symlink in~/.pyenv/versions/
that should be used.The text was updated successfully, but these errors were encountered: