The Question Mark - blog by Mark Volkmann

VS Code Python support

Overview

Pylance is an extension from Microsoft that utilized the Language Server Protocol (LSP) to enable IDE features such as code completion, parameter suggestions, auto-imports, code outline, code navigation, syntax checking, type checking, and syntax highlighting.

Modify settings.json to enable this extension and configure options.

  "python.languageServer": "Pylance",

For strict type checking, add the following:

  "python.analysis.typeCheckingMode": "strict",

To avoid adding two blank lines before and after each function definition:

  "python.formatting.autopep8Args": ["--ignore=E302,E305"],

To enable the Pyright type checker to use type stub files that you have downloaded, add the following (THIS DID NOT WORK!):

  "pyright.stubPath": "{directory-path}",

More detail is coming soon!