Skip to content

AB Experiments

Kartik Raj edited this page Jul 2, 2020 · 29 revisions

Experiment - DeprecatePythonPath

TL;DR

In short,

  • python.pythonPath setting is being removed from all 3 scopes - User, workspace, workspace folder.
  • A new user setting python.defaultInterpreterPath is introduced which is meant as a replacement for python.pythonPath in user scope, but not in workspace scope.
  • A VSCode internal storage is introduced which will now store the interpreter settings in the workspace & workspace folder scope. i.e workspace settings are no longer stored in settings.json, but an internal storage.
    • You can change the value stored using Python: Select Interpreter command.
    • See the Python output channel to check the value of the interpreter selected.
    • You can clear the value stored using Python: Clear Workspace Interpreter Setting command.

Description

The DeprecatePythonPath experiment changes how the Python extension stores, and users set, the path to a Python interpreter for a given Workspace. Previously, the path to the interpreter was stored in the python.pythonPath setting, as specified in the settings.json file. However, this storage method caused problems for users that work on teams that don’t use the same OS, or simply work with interpreters that don’t share the same path. In these situations, the setting is not valid across the team, making the process of storing a project’s settings.json in version control difficult. There're some security concerns regarding storing workspace interpreter path in settings.json as well. Please see Related Issues for more details.

Experience

With the DeprecatePythonPath experiment the experience around setting and storing the interpreter path has changed in the following ways:

• The path to the workspace interpreter will now be stored in VS Code’s persistent storage instead of the settings.json file.

• For users that want to set a default interpreter for all Workspaces, you can use the new User setting python.defaultInterpreterPath.

• For 3rd party extensions that need access to the Python path, you can retrieve it using the extension API. Starting on the June release it will be possible to retrieve it using the command ${command:python.interpreterPath}.

• You can change workspace-specific value using Python: Select Interpreter command. When using the command on the Command Palette, a new option exists to specify an interpreter path.

• You can clear the value stored in workspace settings using Python: Clear Workspace Interpreter Setting command.

Related Issues

https://github.com/microsoft/vscode-python/issues/2125

https://github.com/microsoft/vscode-python/issues/7805

FAQ

Q: Can I opt out of the experiment?

A: You can opt out of any experiment by opening the user settings.json file (View > Command Palette… and run Preferences: Open Settings (JSON)) and set the “python.experiments.optOutFrom” setting to [“All”], or to specific experiments you wish to opt out from.

Q: How do I know if I’m part of the experiment?

A: To see if you are part of an experiment, you can check the first lines in the Python extension output channel.

Q: How do I add myself to the experiment?

A: You can opt in to this functionality by adding the following line to your User settings. First, run Preferences: Open Settings (JSON) and then, once you’ve added the line, reload the window by running Developer: Reload Window. "python.experiments.optInto": ["DeprecatePythonPath - experiment"]

Q: How do I report a problem I’m having with this experiment?

A: If you’re having a problem with the experiment or wish to provide feedback, please log an issue at https://github.com/Microsoft/vscode-python/issues.

Clone this wiki locally