Programming language Python: Microsoft's VS Code gets Pylance to 'supercharge' coding

Microsoft says its new Pylance language server will make Python developers who use VS Code far more productive.
Written by Liam Tung, Contributing Writer

Microsoft has released a new language server for Python called Pylance, which uses the Language Server Protocol to communicate with Microsoft's popular open-source, cross-platform code editor, Visual Studio Code (VS Code).

Pylance, now available as an extension on the Visual Studio Marketplace, delivers a "drastic improvement for the Python experience in Visual Studio Code", according to Savannah Ostrowski, program manager for Python Language Server and Python in Visual Studio.

Pylance could benefit a lot of Python developers given that Microsoft's Python extension for VS Code is by far the most popular language extension on Microsoft's marketplace. 

SEE: Hiring Kit: Python developer (TechRepublic Premium)

Pylance is based on Microsoft's Pyright static type-checking tool for Python, which it released last year to help developers quickly clean up and auto-complete code snippets.  

"Pyright's type-checking functionality and language features are now incorporated into a VS Code extension called Pylance, the officially supported Python Language Server from Microsoft," Microsoft says in its Pyright page on GitHub

"Pylance is designed to work with the Python extension for VS Code. In addition to Pyright's functionality, Pylance adds compatibility with several advanced features including IntelliCode for AI-assisted completions. If you are a VS Code user, we recommend that you uninstall Pyright and instead install Pylance. You will get all the benefits of Pyright and more."

The new GitHub repository for Pylance, which Microsoft is using to gather feedback, says it will drastically improve developer productivity and Python code quality. 

"Using Pyright, Pylance has the ability to supercharge your Python IntelliSense experience with rich type information, helping you write better code faster," Microsoft says. 

Microsoft warns against installing Pyright and Pylance together because that will result in duplicate errors, hover text, and suggested code completions. There are differences between the two, though. 

"Pylance leverages Pyright's functionality with additional features, some of which are not open-sourced," Microsoft states in an FAQ. 

Also, Pyright is now an officially supported Microsoft type checker for Python. Microsoft intends to develop and maintain it as an open-source project under an MIT license. However, the Pyright extension for VS Code isn't guaranteed to be fully functional or maintained in the long term.

SEE: GitHub to replace "master" with alternative term to avoid slavery references

Pylance builds on the 2018 release of the Python Language Server, which brought Python IntelliSense to VS Code. 

Pylance's key features include type information, auto-import suggestions, and type-checking diagnostics. 

Users can set Pylance's type-checking mode at python.analysis.typeCheckingMode to 'basic' or 'strict'.

"This setting uses Pyright's type checking to apply either a basic or comprehensive set of rules over your codebase, respectively. The diagnostics produced from this mode can help improve the quality of your code and help you find edge cases more easily," said Ostrowski. 

More on Microsoft's Visual Studio Code

  • Microsoft VS Code turns 5: How GitHub, open source, Google made it a hit, reveals creator  
  • Programming language Go: Microsoft hands VS Code Go extension to Google's Go team  
  • Microsoft: This new update makes VS Code friendlier for Java programming language jobs  
  • Programming language Python VS Code extension: New update has critical security fix
  • Microsoft's VS Code 1.45 is out: GitHub integration plus JavaScript debugger update
  • Microsoft: Bosque is a new programming language built for AI in the cloud  
  • Microsoft's VS Code Python programming language extension gets this new update  
  • Microsoft: Try VS Code's new Python, C++ programming language tutorials, Docker updates  
  • Microsoft makes new GitHub collaboration tools available to testers  
  • Programming languages: Python and Java VS Code extensions get these new updates  
  • VS Code gets a big update: Plays nice with macOS Gatekeeper plus lots of new features  
  • Microsoft: VS Code for PowerShell 7 arrives with ISE mode  
  • New Microsoft VS Code browser editor update – better Go, Python language, Docker support  
  • Microsoft's VS Code Python programming language extension gets this new update  
  • Microsoft VS Code 1.42 is out: New debug tools for TypeScript, JavaScript, Chrome  
  • ServiceNow reveals VS Code alternative to its own web-based code editor  
  • Microsoft boosts programming language Python's popular VS Code extension  
  • Programming language Python's popular extension for Visual Studio Code revamped  
  • Facebook: Microsoft's Visual Studio Code is now our default development platform
  • JPMorgan's Athena has 35 million lines of Python code, and won't be updated to Python 3 in time TechRepublic
  • Mozilla's radical open-source move helped rewrite rules of tech CNET
  • Editorial standards