June 9th, 2022

Python in Visual Studio Code – June 2022 Release

Luciana Abud
Program Manager

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

This release includes improvements to: 

  • Localization support  
  • Python interpreter discovery 
  • Jupyter extension support on vscode.dev/github.dev  
  • Insiders program for Pylance  

If you’re interested, you can check the full list of improvements in our changelogs for the Python, Jupyter and Pylance extensions. 

Improved localization support  

The Python extension now supports translations in all the languages that VS Code supports. We have updated the way we get the text of our commands, notifications, and titles to use translations that are maintained by a localization team, to ensure that they are up to date and correct. 

VS Code Python commands translated to Portuguese (Brazil) Theme: Horizon Extended. Language mode: Portuguese (Brazil). 

To try it out, you can change the display language in VS Code by running the Configure Display Language command in the command palette (Ctrl+Shift+P or ++P).

Improvements in Python interpreter discovery 

We also made improvements to when discovery of Python interpreters is triggered.  

Previously, the Python extension would try to find Python interpreters every time it activated/loaded. Starting in this release, interpreter discovery is only triggered when a new folder or workspace is opened for the first time, when the “Python: Select Interpreter” command is triggered, and when the interpreters list is refreshed. This leads to much faster load times and startup of features like the language server.  

Note that if the Jupyter  extension is installed/enabled, discovery is still triggered by Jupyter at startup. We’re working towards improving this flow in the future.  

New Jupyter extension features on vscode.dev/github.dev  

We’ve made progress on supporting more of the core functionality in the new web version of the Jupyter  extension. 

This month we ported the following features to the web extension: 

  • https support 
  • kernel completions 
  • ipywidgets 
  • notebook debugging 
  • variable viewing 
  • exporting 
  • interactive window 

If you’d like to experiment with the functionality, you can launch Jupyter from your local machine with the following:  

jupyter notebook --no-browser --NotebookApp.allow_origin_pat=https://.*\.vscode-cdn\.net

You can then connect to it using the “Jupyter: Specify Jupyter server for connections” command from within vscode.dev. 

For more information and for providing feedback, see this discussion item. 

Pre-release Pylance extension 

The Pylance extension offers an Insiders program, where you can get preview updates and try the latest features and bug fixes earlier on. Before this release, one would opt into it via a setting, and then every week a new build would be downloaded and installed, and a prompt would be displayed to reload the window to enable the new update. 

Given that the Python extension successfully migrated its insiders program in the March 2022 release to pre-release versions, we’re now doing the same for Pylance to provide a smoother opt-in and upgrade experience. You can install a pre-release version by opening the extension’s view in VS Code (Ctrl + Shift + X or ⌘ + ⇧ + X), searching for Pylance, and opening the Pylance extension. If you already have the extension installed, you will be able to click on the “Switch to Pre-Release Version” button next to the “Uninstall” button: 

Switch to pre-release version button in VS Code's extension view when opening the Pylance extension

If you don’t have it installed, you will be able to click on the down arrow next to the Install button and select “Install Pre-Release Version”: 

Switch to pre-release version option when Pylance is not installed in VS Code

If you were part of the Insiders program and had the “pylance.insidersChannel” setting set to “daily”, you will automatically start using the pre-release versions of the Pylance extension. The setting will also be removed as it’s no longer supported. 

If you’re also interested in getting the latest Python and Jupyter notebook features and bug fixes early on, you can similarly install pre-release versions of the Python and the Jupyter extension. 

What would Brett do? 

The Engineering Manager of the Python extension and Python Steering Council member Brett Cannon has created a new experimental extension for setting up Python environments, called WWBD (which stands for “What would Brett do?”).  

Through a command called “WWBD: Create environment”, it offers a very opinionated flow of creating a virtual environment using venv, and automatically installing dependencies if they’re listed in a requirements file on the workspace. 

We’re looking for feedback on this experience at the repository, as we explore the possibility of integrating this flow into the Python extension itself in the future.  

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: 

  • Experimental Feature: Pylance now treats each Jupyter notebook cell as a separate document rather than concatenating the cells together into a single document. It has the potential to fix a lot of Pylance notebook behaviors. It can be enabled by setting ”python.pylanceLspNotebooksEnabled”: true. 
  • Improve information collected by the “Python: Report Issue” command. (vscode-python#19067) .
  • Jupyter notebooks no longer freeze on typing or executing (pylance-release#2783).  
  • Show completion suggestions for overriding inherited class variables (pylance-release#2059). 
  • Pylance now gets the stubs from the repo maintained by pandas-dev. Please open pandas stub issues there going forward (python-type-stubs#208). 

We would also 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. 

Author

Luciana Abud
Program Manager

Product Manager at Microsoft for Python in Visual Studio Code

0 comments

Discussion are closed.