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

Test pyenv environments are autoselected #23114

Closed
3 tasks done
karrtikr opened this issue Mar 22, 2024 · 5 comments
Closed
3 tasks done

Test pyenv environments are autoselected #23114

karrtikr opened this issue Mar 22, 2024 · 5 comments
Assignees
Labels
testplan-item Test plan item/assignments for upcoming release
Milestone

Comments

@karrtikr
Copy link

karrtikr commented Mar 22, 2024

Refs: #1167

Complexity: 4

Create Issue


Requirements

  • Python extension pre-release

Verification

  • Install pyenv if not already, make sure to reopen shells after:
  • Run pyenv --version to check if the installation was successful.
  • Run pyenv install -l to check a list of Python versions supported by pyenv
  • Run pyenv install <version> to install a couple of supported versions
  • Run pyenv global <version> to set a Python version as the global version, for eg. pyenv global 3.9.0
  • Run pyenv which python and record the full path to python somewhere
  • Create a new workspace folder with a Python file
  • Run Python: Clear cache and reload window command
  • Make sure the recorded python is the one which is selected:
    image
  • Run pyenv local <version> command to select another version of Python
  • Run Python: Clear cache and reload window command, make sure the latest version set is now selected
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Mar 22, 2024
@karrtikr karrtikr added testplan-item Test plan item/assignments for upcoming release and removed triage-needed Needs assignment to the proper sub-team labels Mar 22, 2024
@github-actions github-actions bot added this to the March 2024 milestone Mar 25, 2024
@joyceerhl joyceerhl removed their assignment Mar 25, 2024
@rzhao271 rzhao271 assigned rzhao271 and unassigned hbons Mar 25, 2024
@rzhao271
Copy link

rzhao271 commented Mar 25, 2024

This TPI didn't seem to work for me on macOS with zsh.
pyenv global: 3.6.15
pyenv local in the specific workspace folder: 3.11.8
Recommended interpreter after running code-insiders . inside the specific folder: pyenv 3.12.2

@rzhao271 rzhao271 removed their assignment Mar 25, 2024
@connor4312
Copy link
Member

This worked for me on Fedora, but I wonder if there should be an easier way for users to refresh their pyenv without having to clear cache and reload window. Maybe you can detect if a pyenv command was run in the terminal with shell integration as a starting point?

@karrtikr
Copy link
Author

@connor4312 Pyenv environments are currently considered global environments, so we only automatically trigger discovery once for them. Maybe if we had a global watcher, or watch for all commands being run as you said, that could solve the issue. But we've noticed previously that it leads to a performance overhead and overall loss in experience.

Created #23139 which should make things better for now: we can look if we have a .python-version in the new workspace, to decide whether we should trigger pyenv discovery.

This issue should also be addressed with #22836 once Pyenv extension which manages its own environments.

@LoganB99
Copy link

@karrtikr @connor4312 does this issue have anything to do with launch.json not respecting my pipenv virtualenv? this used to work, but now i am getting errors that a module is not found if i run python through the debug console.. it is installed in my pipenv, but for some reason it is looking in my global pyenv for the module??

@LoganB99
Copy link

resolved, sorry

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testplan-item Test plan item/assignments for upcoming release
Projects
None yet
Development

No branches or pull requests

6 participants