A weekly Python podcast hosted by Christopher Bailey with interviews, coding tips, and conversation with guests from the Python community. The show covers a wide range of topics including Python programming best practices, career tips, and related software development topics. Join us every Friday morning to hear what's new in the world of Python programming and become a more effective Pythonista.
Using Pylance to Write Better Python Inside of Visual Studio Code
A big decision a developer has to make is what tool to use to write code? Would you like an editor that understands Python, and is there to help with suggestions, definitions, and analysis of your code? For many developers, its the free tool, Visual Studio Code. This week on the show, we have Savannah Ostrowski, program manager for the Python Language Server and Python in Visual Studio. We discuss Pylance, a new language server with fast, feature-rich language support for Python in VS Code.
Savannah explains what a language server is and the types of features it can provide. This includes type information, code completion, automatic-imports, dead code analysis, code navigation, and more. We also have a discussion about type checking in Python, which led to how Pylance leverages the static type checking tool Pyright, and what are type stubs (.pyi files).
Course Spotlight: Python Type Checking
In this course, you’ll look at Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit way. Recent versions of Python allow you to specify explicit type hints that can be used by different tools to help you develop your code more efficiently.
Topics:
- 00:00:00 – Introduction
- 00:01:47 – Current Role at Microsoft
- 00:03:01 – Background with Python
- 00:04:21 – Origins of Pylance
- 00:06:53 – What is a language server?
- 00:09:56 – Diving deeper into the features individually
- 00:14:42 – Code navigation and diagnostics
- 00:15:43 – Methods of defining types and stub files
- 00:17:28 – What are examples of stub files?
- 00:21:16 – Comparing Pyright to Mypy
- 00:23:56 – Video Course Spotlight
- 00:25:02 – Auto-imports are a contentious feature
- 00:28:36 – Code actions and dead code analysis
- 00:31:46 – Pylance working with Jupyter notebooks in VSCode
- 00:33:30 – Multiple workspaces
- 00:36:16 – Why do you like to work on developer tools?
- 00:39:35 – How does a tool like Pylance help a beginner?
- 00:42:31 – What are you excited about in the world of Python?
- 00:46:25 – What do you want to learn next?
- 00:49:24 – Thanks and goodbyes
Show Links:
- Announcing Pylance: Fast, feature-rich language support for Python in Visual Studio Code
- Pylance introduces five new features that enable type magic for Python developers
- Python in Visual Studio Code – September 2020 Release
- Pylance and Python in VS Code: Visual Studio Code v1.49 Release Party - YouTube
- Language Server Protocol
- Language Server Protocol: Github
- How the Language Server Protocol Affects the Future of IDEs
- typeshed: External type annotations for the Python standard library and Python builtins, as well as third party packages
- Pyright: Static type checker for Python
- PEP 561 – Distributing and Packaging Type Information
- Visual Studio IntelliCode: Provides AI-assisted development features for Python
- Creating Stubs For Python Modules
- Python Type Checking: Real Python video course
- Feather Huzzah: Adafruit
- Circuit Playground Express: Adafruit
- Circuit Python: The easiest way to program microcontrollers
- Big Honking Button: Winterbloom
- Arduino With Python: How to Get Started - Real Python video course