Pull to refresh
Microsoft — мировой лидер в области ПО и ИТ-услуг

Python in Visual Studio Code – September 2019 Release

Microsoft corporate blog Python *Programming *Visual Studio *
We are pleased to announce that the September 2019 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.

This was a short release where we closed 35 issues, including improvements to the Python Language Server and to Jupyter Notebook cell debugging, as well as detection of virtual environment creation. The full list of enhancements is listed in our changelog

This article in our blog.

Improvements to Python Language Server 

The Python Language Server now has linting capabilities, and its latest release includes new linting messages and a variety of additional general improvements, which are listed in the section «Other changes and enhancements» below.   

The linting messages provided by the Python Language Server include detecting unresolved imports, undefined variables, too many arguments in a function call, unknown keyword arguments and inheriting from something that is not a class. To see the full detailed list of linting messages, you can check the documentation in the Language Server GitHub repo or the settings reference page within the Python for Visual Studio Code docs. 

We’ve also added general #noqa support, so linting messages can be disabled on a case by case basis. Lines with a #noqa comment will have their diagnostic output suppressed. For more information, you can check the documentation

Improvements to Jupyter Notebook cell debugging

In the August release, we added the ability to debug Jupyter notebook cells where you can step into user code. In this release, this feature is enhanced with the option to also step into non-user code if needed. To enable, open the settings page (File > Preferences > Settings), search for «Data Science: Debug Just My Code» and uncheck the option. 

Once the setting is disabled, you’ll be able to step into function calls and, for example, inspect the non-user code behavior and how variables change when it’s being executed.  

Detection of virtual environment creation  

The Python interpreter displayed on the status bar indicates which environment the Python extension is using for running Python code (using the Python: Run Python File in Terminal command, for example), and to provide language services such as auto-completion, syntax checking, linting, formatting, etc:

In this release, when a new virtual environment is created, a prompt will be displayed asking if you’d like to select its interpreter for the workspace:  

This will add the path to the Python interpreter from the new virtual environment to your workspace settings, and therefore that environment will be used when installing packages and running code through the Python extension.  

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: 

  • Update Jedi to 0.15.1 and parso to 0.5.1. (#6294
  • Bump version of PTVSD to 4.3.2. 
  • Added a setting to allow Python code to be executed when the interactive window is loading. (#6842
  • Add debug command code lenses when in debug mode. (#6672
  • General Improvements for the Python Language Server: 

  • Improved handling of generic classes in inheritance chains (#1278) 
  • Added support for TypeVar bound and generic self (#1242
  • Added support for forward references in type strings (#1186
  • Added goto definition for members in class bases (#1356#1443
  • Improved assignment handling (#1457#1494#411#1382)  

We are continuing to A/B test new features. If you see something different that was not announced by the team, you may be part of an 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 from A/B testing, disable telemetry in Visual Studio Code.  

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.
Total votes 8: ↑8 and ↓0 +8
Views 2.1K
Comments Leave a comment