May 8th, 2025

Python in Visual Studio Code – May 2025 Release

Courtney Webster
Program Manager

We’re excited to announce the May 2025 release of the Python, Pylance and Jupyter extensions for Visual Studio Code!

This release includes the following announcements:

  • Python Environments Quick Create command
  • Python Environments chat tools
  • Automatic environment activation with Python Environments (Experimental)
  • Color picker with Pylance
  • AI Code Actions: Convert Format String (Experimental)
  • PyConUS 2025

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

Python Environments Quick Create command

The Python Environments extension (preview) has added support for Quick Create, making the environment creation process more seamless. Quick Create minimizes the input needed from you to create new virtual environments by detecting the latest Python version on your machine to create an environment and install any workspace dependencies with a single click. This will create a .venv in your workspace for venv based environments, and .conda conda for conda based environments.

You can access Quick Create via the Python: Create Environment command in the Command Palette.

Screenshot showing the Quick Create environment creation option in the Create Environment Quick Pick.

Python Environments chat tools

The Python Environments extension now includes two chat tools: “Get Python Environment Information” and “Install Python Package”. To use these tools, you can either directly reference them in your prompt by adding #pythonGetEnvironmentInfo and #pythonInstallPackage, or agent mode will automatically call the tool as applicable.

“Get Python Environment Information” seamlessly detects the appropriate environment information based on your file or workspace context. This includes the Python version, installed packages, and their versions.

Copilot using the Get Python Environment Information tool to fetch relevant environment information.

“Install Python Package” automatically installs packages in the correct environment based on your workspace context. This means you can easily install packages without worrying about which environment you’re in or which package manager to use.

Copilot calling the Install Python Package tool to automatically install required Python packages.

Automatic environment activation with Python Environments (Experimental)

The Python Environments extension introduced a new mechanism to auto activate your terminals with the correct environment information. The new "python-envs.terminal.autoActivationType" setting can be set to command (default), shellStartup, or off.

When set to command, the Python environments extension sends the appropriate activation command directly to the terminal resulting in activation.

Alternatively, with shell startup activation (shellStartup), the extension updates your shell’s startup script (such as .bashrc, .zshrc, or PowerShell profile) so that whenever you open a new terminal in VS Code, your chosen Python environment is automatically activated. This is only enabled for the zsh, fsh, pwsh, bash, and cmd. Once changes are written to your shell profile, your terminals will need to be refreshed in order for activation to occur.

If you want to undo these changes, simply run the Python Envs: Revert Shell Startup Script Changes command from the Command Palette. This will restore your shell profile and switch back to the previous activation mode.

Color picker with Pylance

Pylance can now display an interactive color swatch directly in the editor for recognized color values in Python files, making it easier to visualize and pick colors on the fly. To try it out, you can enable it by adding setting(python.analysis.enableColorPicker:true) to your settings.json file. Supported formats include #RGB (like “#001122”) and #RGBA (like “#001122FF”).

Screenshot showing Pylance color picker when hex codes are available in your Python code.

AI Code Actions: Convert Format String (Experimental)

When using Pylance, there’s a new experimental AI Code Action for converting string concatenations to f-string or format() enabled via "python.analysis.aiCodeActions": {"convertFormatString": true} setting. To try it out, select the Convert to f-string with Copilot or the Convert to format() call with Copilot Code Actions via the light bulb when selecting a symbol in the string you wish to convert, or through Ctrl + . / Cmd + ..

Convert strings Code Actions, powered by Copilot.

Then once you define a new symbol, for example, a class or a function, you can select the Generate Symbol with Copilot Code Action and let AI handle the implementation! If you want, you can then leverage Pylance’s Move Symbol Code Actions to move it to a different file.

PyConUS 2025

We will be attending PyCon US 2025 in Pittsburgh, PA, May 14-22, and cannot wait to connect with you all! Stop by booth #301 to say hello, learn along with us, and grab some swag!

There are a number of amazing earned and sponsored talks our team will be giving, so make sure to add them to your schedule:

Date Time Location Talk Speaker(s)
Wednesday, May 14th​ 9 a.m.–12:30 p.m. ​ Room 320​ AI crash course for Python developers – PyCon US 2025​ Anthony Shaw ​
Wednesday, May 14th​ 1:30 p.m.–5 p.m. ​ Room 317​ Snakes in a Grid: Working with spreadsheets in Python + Python in Excel – PyCon US 2025​ Sarah Kaiser​
Thursday, May 15th​ 3:30 p.m.–4:30 p.m. ​ Room 316​ Build modern Python apps on Azure (Sponsor: Microsoft) – PyCon US 2025​ Rohit Ganguly, Pamela Fox​
Saturday, May 17th​ 4:15 p.m.–4:45 p.m. Room 301-305​ What they don’t tell you about building a JIT compiler for CPython – PyCon US 2025​ Brandt Bucher​
Sunday, May 18th​ 1 p.m.–1:30 p.m. Room 301-305 ​ Going faster in all directions at once: How two teams are working together to make Python better for all – PyCon US 2025​ Michael Droettboom

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:

  • Branch coverage for Python is now supported in the Testing Explorer! Note that your coveragepy version must be >= 7.7 for this feature. You can upgrade coverage by running pip install coverage==7.7.

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.

Category
Python
Topics
python

Author

Courtney Webster
Program Manager

0 comments