{"id":7775,"date":"2020-06-30T14:14:28","date_gmt":"2020-06-30T22:14:28","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=7775"},"modified":"2020-07-01T08:35:18","modified_gmt":"2020-07-01T16:35:18","slug":"announcing-pylance-fast-feature-rich-language-support-for-python-in-visual-studio-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/announcing-pylance-fast-feature-rich-language-support-for-python-in-visual-studio-code\/","title":{"rendered":"Announcing Pylance: Fast, feature-rich language support for Python in Visual Studio Code"},"content":{"rendered":"<p>We are excited to announce Pylance, our fast and feature-rich language support for Python! Pylance is available today in the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.vscode-pylance\" target=\"_blank\" rel=\"noopener noreferrer\">Visual Studio Code marketplace<\/a>.<\/p>\n<p>Pylance depends on our <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\" target=\"_blank\" rel=\"noopener noreferrer\">core Python extension<\/a> and builds upon that experience, for those of you who have already installed it.<\/p>\n<h2>Optimized performance<\/h2>\n<p>Pylance is a new language server for Python, which uses the Language Server Protocol to communicate with VS Code.<\/p>\n<p><em>The name Pylance serves as a nod to Monty Python\u2019s Lancelot, who is the first knight to answer the bridgekeeper\u2019s questions in the Holy Grail.<\/em><\/p>\n<p>To deliver an improved user experience, we\u2019ve created Pylance as a brand-new language server based on Microsoft\u2019s <a href=\"https:\/\/github.com\/microsoft\/pyright\" target=\"_blank\" rel=\"noopener noreferrer\">Pyright<\/a> static type checking tool. Pylance leverages type stubs (<a href=\"https:\/\/www.python.org\/dev\/peps\/pep-0561\/\" target=\"_blank\" rel=\"noopener noreferrer\">.pyi files<\/a>) 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.<\/p>\n<p>In 2018, the Python team at Microsoft released the Python Language Server, bringing Visual Studio\u2019s 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.<\/p>\n<p>Today, we are happy to announce the outcome of this work as the new Pylance language server.<\/p>\n<p>Alongside its performance, there are a few great features that Pylance offers.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Type Information<\/strong><\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-7776 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2020\/06\/type_information.gif\" alt=\"Image type information\" width=\"830\" height=\"330\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Auto-Imports<\/strong><\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-7778 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2020\/06\/auto_imports.gif\" alt=\"Image auto imports\" width=\"830\" height=\"361\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Type Checking Diagnostics<\/strong><\/p>\n<p>If you are excited about types in Python, you can try out Pylance\u2019s type checking mode by setting python.analysis.typeCheckingMode to basic or strict. This setting uses Pyright\u2019s 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.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-7797 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2020\/06\/typecheckingmode_setting_final.gif\" alt=\"Image typecheckingmode setting final\" width=\"1500\" height=\"554\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Multi-Root Workspace Support<\/strong><\/p>\n<p>Pylance natively supports <a href=\"https:\/\/code.visualstudio.com\/docs\/editor\/multi-root-workspaces\" target=\"_blank\" rel=\"noopener noreferrer\">multi-root workspaces<\/a>, meaning that you can open multiple folders in the same Visual Studio Code session and have Pylance functionality in each folder.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-7795 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2020\/06\/multiroot_final.gif\" alt=\"Image multiroot final\" width=\"1500\" height=\"554\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Using the Pylance Language Server with the Python Extension<\/h2>\n<p>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 <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.vscode-pylance\" target=\"_blank\" rel=\"noopener noreferrer\">downloading the extension<\/a> straight from the Visual Studio Code marketplace. Upon installation, the Python extension will recognize that you\u2019ve 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.<\/p>\n<h3><img decoding=\"async\" class=\"alignnone size-full wp-image-7812\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2020\/06\/download_smaller.gif\" alt=\"Image download smaller\" width=\"1500\" height=\"726\" \/><\/h3>\n<p>&nbsp;<\/p>\n<p><em><strong>Note:<\/strong><\/em> If you are a Pyright extension user in VS Code, you&#8217;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.<\/p>\n<h2>The future of the Microsoft Python Language Server<\/h2>\n<p>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\u2019s focus will shift to Pylance to continue evolving it.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>&nbsp;<\/p>\n<h2>Feedback<\/h2>\n<p>If you have any questions, comments, or feedback on your experience, please reach out to us on <a href=\"https:\/\/github.com\/microsoft\/pylance-release\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce Pylance, our fast and feature-rich language support for Python in Visual Studio Code! 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. Keep reading to learn more!<\/p>\n","protected":false},"author":33429,"featured_media":7804,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,6],"tags":[],"class_list":["post-7775","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-visual-studio-code"],"acf":[],"blog_post_summary":"<p>We are excited to announce Pylance, our fast and feature-rich language support for Python in Visual Studio Code! 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. Keep reading to learn more!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/7775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/users\/33429"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/comments?post=7775"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/7775\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/7804"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=7775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=7775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=7775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}