June 30th, 2020

Announcing Pylance: Fast, feature-rich language support for Python in Visual Studio Code

Savannah Ostrowski
Program Manager

We are excited to announce Pylance, our fast and feature-rich language support for Python! Pylance is available today in the Visual Studio Code marketplace.

Pylance depends on our core Python extension and builds upon that experience, for those of you who have already installed it.

Optimized performance

Pylance is a new language server for Python, which uses the Language Server Protocol to communicate with VS Code.

The name Pylance serves as a nod to Monty Python’s Lancelot, who is the first knight to answer the bridgekeeper’s questions in the Holy Grail.

To deliver an improved user experience, we’ve created Pylance as a brand-new language server based on Microsoft’s Pyright static type checking tool. Pylance leverages type stubs (.pyi files) and lazy type inferencing to provide a highly-performant development experience. Pylance supercharges your Python IntelliSense experience with rich type information, helping you write better code, faster. The Pylance extension is also shipped with a collection of type stubs for popular modules to provide fast and accurate auto-completions and type checking.

In 2018, the Python team at Microsoft released the Python Language Server, bringing Visual Studio’s rich Python IntelliSense support to Visual Studio Code. Since our initial release, the Python community has provided us with invaluable feedback about how we can make the user experience of our Python Language Server even better. Over the past several months, we have evaluated how we can make the language server more performant and empower you to write your best code.

Today, we are happy to announce the outcome of this work as the new Pylance language server.

Alongside its performance, there are a few great features that Pylance offers.

 

Type Information

Type information is now available in function signatures and when hovering on symbols, providing you with helpful information to ensure that you are correctly invoking functions, to improve the quality of the code you write.

Image type information

 

Auto-Imports

One of our most requested features is finally here! With auto-imports, you are now able to get smart import suggestions in your completions list for installed and standard library modules.

Image auto imports

 

Type Checking Diagnostics

If you are excited about types in Python, you can try out Pylance’s type checking mode by setting 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.

Image typecheckingmode setting final

 

Multi-Root Workspace Support

Pylance natively supports multi-root workspaces, meaning that you can open multiple folders in the same Visual Studio Code session and have Pylance functionality in each folder.

Image multiroot final

 

Using the Pylance Language Server with the Python Extension

The new Pylance extension is complementary to the Python extension for VS Code that you know and love. If you have the Python extension installed, you can try out Pylance by downloading the extension straight from the Visual Studio Code marketplace. Upon installation, the Python extension will recognize that you’ve installed Pylance and prompt you to select it as your language server. If you are not already using the Python extension in VS Code, installing Pylance will fetch that extension as well.

Image download smaller

 

Note: If you are a Pyright extension user in VS Code, you’ll want to uninstall Pyright when installing Pylance. All Pyright functionality is included in Pylance. By having both extensions installed, you may encounter installation conflicts and see duplicative diagnostics (e.g., errors, warnings) surface in your code.

The future of the Microsoft Python Language Server

Pylance represents a drastic improvement for the Python experience in Visual Studio Code, to which our team has dedicated months of work. The new, free language server offers increased performance and many more features. Because of that, our team’s focus will shift to Pylance to continue evolving it.

In the short-term, you will still be able to use the Microsoft Python Language Server as your choice of language server when writing Python in Visual Studio Code.

Our long-term plan is to transition our Microsoft Python Language Server users over to Pylance and eventually deprecate and remove the old language server as a supported option.

 

Feedback

If you have any questions, comments, or feedback on your experience, please reach out to us on GitHub.

Author

Savannah Ostrowski
Program Manager

Savannah is the Program Manager for Pylance at Microsoft.

21 comments

Discussion is closed. Login to edit/delete existing comments.

  • Igor Cruz

    I am getting an error when defining Pylance as the language server in user’s settings. Besides that, great job!

    settings:
    “python.languageServer”: “Pylance”

    message:
    “Value is not accepted. Valid values: “Jedi”, “Microsoft”, “None”.”

  • Vincent Zhang

    pylance looks great! but I want to know why it’s not open-sourced, and cannot be used in other editor? The License sucks!!!

  • Emin Buğra Saral

    Thanks for the long waited extension! But auto importing feature is not working, whatever I tried. 🙁

  • Fahrer Feyton Fabruce

    I have switched to pylance today, but as I was using pycodestyle for formatting and I have sort Imports on save set to True. My imports are being deleted on formatting.
    I had to turn off sort Imports on save in order to tackle the problem, but all around this server is very good.

    • ismaeil sahab

      really? how check the site is pyhton or no? https://ismaeilsahab.ir/

    • Rov McGlynn

      really? how check the site is pyhton or no?

  • Fawad Raza

    Too new for me to switch.
    But will star and keep and watch on GitHub. Perhaps switch in a year’s time.

  • Adam Machanic

    This looks very cool! Can you comment on how — or whether — it plays with the IntelliCode extension? I’ve been using that for some time now and it really improves the VS Code Python experience. Should I uninstall that if I’m using this, or..?

    Thanks!

    • Savannah OstrowskiMicrosoft employee Author

      Hey Adam! Thanks for the kind words!

      Pylance is completely compatible with IntelliCode! You should install the Pylance extension alongside the IntelliCode extension.

      • Or Chen

        Hey,

        I have Pylance and IntelliCode, but IntelliCode extension requires to activate Microsoft Python Language Server
        and Pylance needs to enable its own language server…
        I am wondering how they can work together?

        Thanks!

      • Adam Machanic

        Thanks for the reply. I tried it out and it worked mostly great, but I hit an issue where half of the code in one of my modules was grayed out and marked as “inaccessible.” I’m certainly looking forward to a more stable experience, but aside from that hiccup it seems to be a huge upgrade.

      • Savannah OstrowskiMicrosoft employee Author

        Hey Adam. Would you mind filing an issue on our repo ? I’d love to get some additional details around the issue your running into and see if we can figure out what’s going on.

  • Jason K Bellew

    Time for the silly question….does this or can this replace pylint or mypy?

  • Erick Ricardo Mendonça Santos

    This looks awesome. I’m trying it now!

  • Carmichael, George

    Looks great! Installed 🙂