Updated Python support in VS Code brings browser editing and ditches open-source language server for Pylance

Proprietary code creep?

Microsoft has updated Python support in Visual Studio Code, introducing editing in a web browser. The company has also archived its open-source Python language server in favour of the closed-source Pylance.

The Python Extension has over 41 million installs, according to the stats, versus just over 3 million for a third-party Python extension, which uses pyLint or flake8 for the linter (both open source).

Language servers provide the engine that drives programming language-specific features in the VS Code editor, such as syntax highlighting, code completion, and error detection. Microsoft's first go at a Python language server was in 2018 and is open source.

Pylance was introduced in June 2020 (the name is based on Monty Python and the Holy Grail's Lancelot). Features include rich type information when hovering over code symbols, smart import suggestions, and type checking (which can optionally be set to strict).

The Python extension has over 41 million installs

The Python extension has over 41 million installs

Bad news for Python 2.7 coders: support for this, which used to be based on the open-source Jedi project, has been dropped. Official advice is to upgrade to Python 3 or to use Pylance and hope for the best. Some Python libraries only exist in 2.x versions so this can be a problem. It is still possible to use the Python 2.7 runtime for a project, but the smart code editor features will be unreliable.

Also new in this release, and using Pylance, is web-editing support. Web editing is VS Code implemented entirely in the browser, as seen in github.dev and in the announced and then unannounced Visual Studio Code for the Web.

Features that work in this context include semantic highlighting, syntax errors, code navigation with outline support, and function signature help. The web version is handy as it is zero install, though it can lead to an "uncanny valley" experience where it looks familiar but works slightly differently than desktop VS Code.

Python code in the github.dev editor

Python code in the github.dev editor

The VS Code Python extension has a revamped testing interface, according to Microsoft program manager Savannah Ostrowski, and also supports the built-in test explorer.

That said, there seem to be some initial issues with the new test support. One user reported after the update that "this morning running 40 tests took 3 seconds, now it's 40+ seconds," and another confirmed that "Unittest run all tests is extremely slow."

VS Code is one of the most popular editors among Python developers. The Python Developer Survey last year placed it second after JetBrains PyCharm (though note that JetBrains assisted with this survey which may lead to unintended bias) but only by 33 to 29 per cent. VS Code grew by 5 per cent from 2019, so if that is repeated it could be ahead soon.

Although VS Code is free and open source, one less appealing aspect of Pylance is that, unlike Microsoft's original Python Language Server, it is closed source. The licence for Pylance states that "you may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the 'Visual Studio Products and Services') to develop and test your applications."

In mitigation, Pylance is built on a separate project, Pyright, which provides static type checking for Python. Pyright is also a Microsoft project but is open source under the MIT Licence.

Language servers are so fundamental to VS Code that moving extensions like this is arguably undermining the open-source status of the editor, as well as making it harder for the community to fix issues and propose improvements – though there is no problem if the issue is in Pyright, or in the Python Extension itself, which are open source. ®

Similar topics


Send us news

Other stories you might like