The Real Python Podcast

Using Pylance to Write Better Python Inside of Visual Studio Code


Listen Later

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
    • Level up your Python skills with our expert-led courses:

      • Arduino With Python: Getting Started
      • Python Type Checking
      • Finding the Perfect Python Code Editor
      • Support the podcast & join our community of Pythonistas

        ...more
        View all episodesView all episodes
        Download on the App Store

        The Real Python PodcastBy Real Python

        • 4.7
        • 4.7
        • 4.7
        • 4.7
        • 4.7

        4.7

        139 ratings


        More shows like The Real Python Podcast

        View all
        The Changelog: Software Development, Open Source by Changelog Media

        The Changelog: Software Development, Open Source

        288 Listeners

        Software Engineering Daily by Software Engineering Daily

        Software Engineering Daily

        625 Listeners

        Talk Python To Me by Michael Kennedy

        Talk Python To Me

        581 Listeners

        Soft Skills Engineering by Jamison Dance and Dave Smith

        Soft Skills Engineering

        289 Listeners

        Super Data Science: ML & AI Podcast with Jon Krohn by Jon Krohn

        Super Data Science: ML & AI Podcast with Jon Krohn

        302 Listeners

        Python Bytes by Michael Kennedy and Brian Okken

        Python Bytes

        213 Listeners

        Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

        Syntax - Tasty Web Development Treats

        988 Listeners

        Darknet Diaries by Jack Rhysider

        Darknet Diaries

        8,091 Listeners

        Tech Brew Ride Home by Morning Brew

        Tech Brew Ride Home

        969 Listeners

        Practical AI by Practical AI LLC

        Practical AI

        200 Listeners

        AWS Podcast by Amazon Web Services

        AWS Podcast

        206 Listeners

        Django Chat by William Vincent and Carlton Gibson

        Django Chat

        75 Listeners

        Last Week in AI by Skynet Today

        Last Week in AI

        309 Listeners

        Machine Learning Street Talk (MLST) by Machine Learning Street Talk (MLST)

        Machine Learning Street Talk (MLST)

        99 Listeners

        The Pragmatic Engineer by Gergely Orosz

        The Pragmatic Engineer

        69 Listeners