It’s been widely known for many years that Windows is the only mainstream operating system that does not include a Python interpreter out of the box.
For many users who are never going to need it, this helps reduce the size and improve the security of the operating system. But for those of us who do need it, Python’s absence has been keenly felt.
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.
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 go to 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.