Python in Visual Studio Code – Feb 2018 Release

Dan Taylor

We are pleased to announce that the February 2018 release of the Python Extension for Visual Studio Code is now available from the marketplace and the gallery. You can the download the Python extension from the marketplace, or install it directly from the extension gallery in Visual Studio Code. You can learn more about Python support in Visual Studio Code in the VS Code documentation.

In this release have closed a total of 96 issues which have added support for pipenv/pyenv, a preview of the next version of our debugger offering faster Django debugging performance, and fixed some issues related to linting and flask debugging. You can see the full list of changes in this and previous releases in our changelog on GitHub.

Support for pipenv and pyenv environments

There are several tools used by developers for installing and managing different Python versions and environments. The extension previously supported virtualenv and conda, and in this release also supports pipenv and pyenv.

Pipenv is a popular new way to manage virtual environments when doing application development. It offers many benefits for application developers including the ability to separate development and production dependencies, and a centralized management of all pipenv environments on the system. If you use pipenv in a folder, VS code will automatically detect and use the pipenv environment as the selected interpreter:

If you choose to use pipenv in a folder, you will not have the ability to switch to other interpreters/environments. This is because pipenv is designed to control your entire folder, and not work with other interpreters/environments. If you want to use different environments, we recommend using a separate copy of that folder.

On macOS and Linux, pyenv is a popular way install python versions on demand and switch to different python installations. Now VS Code will now be able to find python interpreters installed with pyenv.

Preview of ptvsd 4.0 debugger

Visual Studio Code uses ptvsd, the debug engine also used for the Python workload in Visual Studio. In this release we are experimenting with a new version of our debug engine based on PyDevD, with a basic set of debugging features and some early improvements over the previous version that we want to make available for you to try out:

  • Apps run faster with the debugger attached. With our sample stackoverflow-django app we observed up to a 3x speedup in loading Django pages.
  • You can now debug flask templates:

You can try out the new version of the debugger by taking the following steps:

  1. Use one of the experimental debugger configurations by clicking on Debug > Configure > Add Configuration > Python Experimental
  2. Use the Python: Create Terminal command, and then type pip install ptvsd –pre in the terminal to install the preview version of the debugger
  3. Click Start debugging!

Features supported include:

  • Launching applications
  • Pause/Continue
  • Basic breakpoints and stepping over/into/out
  • Break on exception
  • View/change call stack frames
  • View local and global variables
  • Conditional breakpoints

Features not yet supported include:

  • Go to
  • Local and Remote Attach
  • Django template debugging

In this first preview we are expecting there to be some bugs, and we invite you to try it out and file any issues you find on the Python VS Code GitHub page.

Various improvements and fixes

We have also fixed a number of issues reported by users that should improve your experience working with Python in Visual Studio Code. The full list of improvements is listed in our changelog, some notable improvements are:

  • Installing Pylint was not working in virtual environments created with venv (#404)
  • Print statements were being incorrectly highlighted by Pylint (#722), for now we’ve disabled this rule
  • The default flask debugging templates disable auto-reload (#573), meaning you can now set breakpoints in apps that are configured to have auto-reload
  • Improvements to auto-indentation (#481)
  • The performance of locating and selecting python interpreters has been improved (#666)
  • The keyboard shortcut for formatting python code has been fixed, it was broken in the January release
  • Multiple bugs caused .pylintrc files not to be used over the default pylint rules introduced in the January release (#788, #916, #422)
  • The extension prevents against large runaway memory consumption from Jedi (#263), after Jedi uses 1GB of ram we will automatically kill and restart the process. This can cause a temporary delay with displaying IntelliSense.
  • Improvements to automatic whitespace formatting on enter (#640)
  • Upgraded Jedi to 0.11.1 (#674), fixing an installation problem preventing IntelliSense from working in virtual environments
  • Added Chinese (Taiwan) zh-TW translation

Be sure to download the Python extension for VS Code now to try out the above improvements. If you run into any issues be sure to file an issue on the Python VS Code GitHub page.


Discussion is closed.

Feedback usabilla icon