Skip to content

New Python path experiment does in fact change the python.defaultInterpreterPath #18014

@rohrbrecher

Description

@rohrbrecher

VS Code version

1.62.2

Extension version

v2021.11.1422169775

OS type

Windows

OS version

Windows 10

Python distribution

python.org

Python version

3.6.5

Language server

Default

Expected behaviour

The python extension now uses an internally stored python interpreter path or it will fall back to the default path in the settings. The following order is applied:

  1. Python path defined within the extension on folder level
  2. Python path defined within the extension on workspace level
  3. Python path defined within the folder settings (python.defaultInterpreterPath)
  4. Python path defined within the workspace settings (python.defaultInterpreterPath)
  5. Python path defined within the user settings (python.defaultInterpreterPath)

The documentation (e.g. here https://github.com/microsoft/vscode-python/wiki/AB-Experiments) clearly states that the python.defaultInterpreterPath setting is only read but never modified by the extension.
If a python interpreter is selected using the command "Python: Select Interpreter" the selection is stored "internally" and the settings.json is not affected.

Actual behaviour

When working with a single .py file only, no folder or workspace loaded, using the "Python: Select Interpreter" or "Python: Clear Workspace Interpreter Setting" command will add/change/remove the python.defaultInterpreterPath within the users settings.json.

Steps to reproduce

  • load any python file in an empty VSCode instance
  • VSC will probably use the "recommended" python interpreter
  • open the user settings.json and define a "python.defaultInterpreterPath" (best to use a different python than the recommended one)
  • use the command "Python: Select Interpreter" to pick a different interpreter
  • observe that the defaultInterpreterPath has been changed
  • use the command "Python: Clear Workspace Interpreter Setting"
  • observe that the defaultInterpreterPath is completely removed from the settings

Logs

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

area-editor-*User-facing catch-allbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions