Menu
Microsoft unveils Pylance, a new Python extension for Visual Studio Code

Microsoft unveils Pylance, a new Python extension for Visual Studio Code

Pylance works with the existing Microsoft Python extension to bring faster type checking and program analysis to Python devs

Credit: Dreamstime

Microsoft has pulled back the drapes on Pylance, a Visual Studio Code extension for faster and more complete Python language support in that popular code editor.

Pylance doesn't replace the existing Microsoft-authored Python extension for Visual Studio Code, which has some 21 million installations to its name.

Instead, Pylance expands on the existing Python extension to provide fast, static type checking (using Microsoft's Pyright project), live type information about symbols, autocomplete, auto-imports, code outlining and navigation, and other tools for Python development.

Pylance works with Jupyter notebooks, when those are in use in a project. It can also use custom type stubs from a project directory with the python.analysis.stubPaths option. It's also possible for workspaces, users, or projects to customise which errors get flagged on a codebase and what level of severity to assign them.

For instance, if you have a lot of code that creates variables conditionally, and which you know doesn't create issues, you can disable the reportUnboundVariable option to avoid flagging such code.

When the auto-imports feature is enabled, it automatically inserts appropriate imports for libraries recognised in Pylance's search path. If you type gc.disable() for instance, Pylance will infer that you are referring to the gc module in the standard library, and automatically add import gc as needed at the top of your project.

For the most part, Pylance should work as-is with existing projects, but it may need some special configuration in a couple of cases.

For example, if Pylance flags imports in a project and claims they can't be found, you may need to customise Pylance's search path for the project by adding the python.analysis.extraPaths attribute in settings.json.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags Microsoftpython

Events

Featured

Slideshows

Channel kicks 2021 into gear as After Hours returns to Auckland

Channel kicks 2021 into gear as After Hours returns to Auckland

After Hours made a welcome return to the channel social calendar with a bumper crowd of partners, distributors and vendors descending on The Pantry at Park Hyatt in Auckland to kick-start 2021.

Channel kicks 2021 into gear as After Hours returns to Auckland
The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards

The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards

Hundreds of leaders from the New Zealand IT industry gathered at the Hilton in Auckland on 17 November to celebrate the finest female talent in the Kiwi channel and recognise the winners of the Reseller News Women in ICT Awards (WIICTA) 2020.

The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards
Show Comments