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.
Theme: 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:
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 added a warning indication for conda envs lacking an interpreter with a valid python binary (vscode-python#18934).
- The –user flag is no longer used when installing tools in a virtual environment (vscode-python#14327).
- We resolved a number of IPyWidgetissues related to loading of resources (images, scripts, etc.) in the Jupyter extension, improving support for widgets such as VegaFusion, ipyleaflet, Chemiscope, mobilechelonian, and ipyturtle (vscode-jupyter#10459).
- We added new features to the web version of the Jupyter extension:
- Exporting Interactive Window (vscode-jupyter#10291)
- Debugging Interactive Window
- Collapsible cells in Interactive Window (vscode-jupyter#10524)
We would like to extend special thanks to this month’s contributors:
- Lakshmikanth2001: Add breakpoint support for django-html & django-txt ( vscode-python#19288).
- ksy7588: Fix unittest discovery issue with experimental component (vscode-python#19324).
- usta: Fix variable name for flake8Path’s description (vscode-python#19313).
- ChaseKnowlden: Fix inconsistent link in README (vscode-jupyter#10396).
- kilacoda: Remove extra button from Restart Kernel modal (vscode-jupyter#10539).
- afeld: Add more context around the extension in the README (vscode-black-formatter#82).
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.
The post Python in Visual Studio Code – July 2022 Release appeared first on Python.