Microsoft has released the May 2021 update to the Python Extension for Visual Studio Code, which introduces Pylance as the default language server for Python alongside speedier start-up times and an auto-reload debugger for Python scripts.
It’s based on Microsoft’s Pyright static type-checking tool for Python, which it released in 2019 to help developers quickly clean up and auto-complete code snippets.
Savannah Ostrowski, Microsoft’s Program Manager of Pylance and Python in Visual Studio, said the upgraded support for Pylance within its Python extension – which is its most popular VS Code extension – “provides what we believe is the most performant and user-friendly Python editing experience for Visual Studio Code ever.”
Ostrowski said Microsoft had been making enhancements to Python language support via the Pylance extension since it launched it last year. The company has also been working on making language support better for developers regardless of whether they’re using Pylance or a different language server, and plans to concentrate on offering open-source language support options for users going forward.
“We’ve invested resources to standardize the way that language servers communicate with the Python extension (via Language Server Protocol),” said Ostrowski.
“This work has enabled us to further improve the performance and overall experience of other language servers, like the open-source Jedi language server.”
The May 2021 update also brings markedly improved stability and performance, including faster start-up time. The company is claiming a 10% faster boot time for Windows and macOS users, and up to 20% faster for Linux users, which Ostrowski credited to improvements in Microsoft’s Python environments discovery mechanism. “We’ve also seen that it is decreasing the number of times the Python extension becomes unresponsive by 15% across the board,” said Ostrowski.
Meanwhile, a new debugger feature brings live reload for Python scripts, after previously only supporting Django and Flask. This means that changes to code will be applied even after the debugger hits a breakpoint, without having to reload the debugger for them to take effect.
Miscellaneous changes and improvements to Python in VS Code include:
- A “Default” language server option that dynamically chooses which language server to use
- Automatic indenting following `match` and `case` statemens.
- Addition of a Python: Refresh TensorBoard command
- Added compatability with pypy3.7 interpreter.
Users can download the Python extension here, or install it directly from the extension gallery in Visual Studio Code.