Python in Visual Studio Code – May 2020 Release

Avatar

Luciana

We are pleased to announce that the May 2020 release of the Python Extension for Visual Studio Code is now available. You can download the Python extension from the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about  Python support in Visual Studio Code in the documentation.  

In this release we addressed 42 issues, and it includes the ability to browse for or enter an interpreter path on selectionIf you’re interested, you can check the full list of improvements iour changelog. 

Ability to browse for interpreter path  

To make selecting or changing interpreter easier, you now have the option to browse for a Python interpreter in your file systemYou can also set an interpreter by manually entering its path:

Selecting an interpreter by entering a path and then by browsing for executable file on the system file explorer.Theme: Eva

Coming Next: moving python.pythonPath out of settings.json 

One change that is coming relates to how the Python extension handles Python interpreter selection. Currently the path to the selected interpreter is stored in the workspace settings. This can be a problem when you share VS Code workspace settings in a GitHub repo, for example, as reported in our issue tracker. 

In order to make the interpreter information system agnostic and prevent sharing the interpreter path (which commonly won’t be the same across different machines), we’re going to deprecate the python.pythonPath setting in the Python extension.  You will still be able to set interpreters per workspace, it’ll just be stored internally instead of the workspace settings. 

These changes will be added gradually as an experiment. If you’re interested to try it ahead of time, you can opt into this functionality by adding the following line to your User settings (View Command Palette… and run Preferences: Open Settings (JSON)) and then reloading the window (View Command Palette… and run Developer: Reload Window): 

"python.experiments.optInto": ["DeprecatePythonPath - experiment"]

To see if you are part of an experiment, you can check the first lines in the Python extension output channel. If you wish to opt-out of A/B testing in general, you can open the user settings.json file and set the “python.experiments.enabled” setting to false. 

We also have some additional announcements coming soon, so stay tuned! 

Other Changes and Enhancements 

We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. Some notable changes include: 

  • CVE-2020-1171Do not perform pipenv interpreter discovery on extension activation. (#11127) 
  • CVE-2020-1192: Setting “Data Science: Run Startup Commands” is now limited to being a User scope only setting.
  • Performance improvements when executing multiple cells in Notebook and Interactive Window using ipywidgets. (#11576) 
  • Fix for opening the interactive window when no workspace is open. (#11291) 
  • Update Jedi 0.17 (thanks Peter Law) (#11221)

Be sure to download the Python extension for Visual Studio Code now to try out the above improvements. If you run into any problems, please file an issue on the Python VS Code GitHub page. 

 

8 comments

Comments are closed. Login to edit/delete your existing comments

    • Avatar
      Luciana AbudMicrosoft employee

      It can be useful if you’re working on a project with a team, and you all want to use the same formatter, linting and editor settings overall. We’ve heard from a lot of users that they would like to not add .vscode to .gitignore because it’d be useful to share some settings, but they often did solely because of the existence of python.pythonPath setting.

    • Avatar
      Luciana AbudMicrosoft employee

      It will be located in VS Code’s persistent storage. It’s also worth mentioning that the path to the selected interpreter will be printed in the Output panel, and that we’re also working on a documentation to clarify these changes.

    • Avatar
      Luciana AbudMicrosoft employee

      You will still be able to select interpreters per workspace, like for venv. We’ll just stop storing it in the settings.json file, it’ll exist in VS Code’s persistent storage instead. You’ll also be able to copy the path to the selected interpreter from the Output panel.
      For a smooth experience with WSL, we recommend the Remote – WSL extension.

  • Andreas Galazis
    Andreas Galazis

    I don’t agree that discontinuing interpreter configuration in vscode config is useful. You can already apply it in user settings instead of project. Adding it to the project is just an option tha people can easily skip

    • Avatar
      Luciana AbudMicrosoft employee

      You will continue to be able to specify the setting per workspace. We are simply storing it using VS Code’s persistent storage instead of your settings file, so you will continue to need to only set it once. Taking this setting out of the file allows it to be committed to version control and shared among team members.