Python in Visual Studio Code – July 2022 Release

Luciana Abud

We’re excited to announce that the July 2022 release of the Python and Jupyter extensions for Visual Studio Code are now available.

This release includes inlay type hints with Pylance and improvements to the setup experience with Jupyter notebooks. If you’re interested, you can check the full list of improvements in our changelogs for the Python, Jupyter and Pylance extensions.

Inlay Type Hints

Inlay hints add inline information to your code in the editor to help you understand the meaning of a variable or a function at a glance.

In this release, we have added two types of inlay hints when using Pylance: for variable types and for return types.

Return type inlay hints show the return types of functions that don’t have an explicit annotation. To enable it, you can set “python.analysis.inlayHints.functionReturnTypes”: true to your user settings (Preferences: Open Settings (JSON) command).

Similarly, variable type inlay hints show the types of variables that don’t have explicit type annotations. You can enable it by setting “python.analysis.inlayHints.variableTypes”: true.

Type hint information displayed next to variables and functions in VS CodeTheme: Horizon Extended

It’s worth noting these hints don’t cause changes to your code, they only add information to the editor’s user interface. However, we are working on adding support for adding the suggested annotations to your code, so stay tuned!

Improvements to the setup experience with Jupyter notebooks

We have improved the extension recommendation flow from within a notebook to help improve the getting started experience when you don’t have the Python or Jupyter extensions installed. Once you open a Jupyter notebook in VS Code, you will see a “install suggested extensions” entry when you try to run a cell or select a kernel:

Option to install suggested extensions (Python and Jupyter) when clicking on select kernel or run cell buttons.

This change greatly reduces the number of steps needed to get the first notebook cell run within VS Code.

Other Changes and Enhancements

We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python and Jupyter Notebooks in Visual Studio Code. Some notable changes include:

We would like to extend special thanks to this month’s contributors:

Try out these new improvements by downloading the Python extension and the Jupyter extension from the Marketplace, or install them directly from the extensions view in Visual Studio Code (Ctrl + Shift + X or ⌘ + ⇧ + X). You can learn more about Python support in Visual Studio Code in the documentation. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.