Python in Visual Studio Code September 2023 Update

Author: Courtney Webster - Program Manager, Python Extension in Visual
Studio Code
Typesetting: Alan Wang

We’re excited to announce that the Python and Jupyter extensions for Visual Studio Code will be released in September 2023!
This release includes the following:
• Added Python "Recreate" or "Use Existing" options to Python : Create Environment
• Experimental terminal activation using environment variables
• Community-contributed yapf extension

If you're interested, you can check out the full list of improvements in our Python , Jupyter and Pylance extension changelog.

Add Python's "Recreate" or "Use Existing" option to Python: Create Environment

When working in a workspace that already contains .venva folder, the "Python: Create Environment" command has been updated to give you the option to recreate or use an existing environment. If you choose to recreate the environment, your current .venvenvironment will be deleted, allowing you to recreate a .venvnew environment named . You can customize this new environment by following the Python: Create Environment process, selecting your preferred interpreter, and specifying any dependency files to install. If the environment cannot be deleted, for example, because the environment is active, you will be prompted to delete the environment manually.

Alternatively, if you choose to use an existing environment, that environment is selected for the workspace.

“Recreate” or “Use Existing” option

Experimental terminal activation using environment variables

This month we will start rolling out terminal activation using environment variables that activate selected environments in the terminal without any activation commands. With this new experience, the Python extension uses environment variables to activate the terminal, which is done implicitly when the terminal is started, resulting in a faster experience, especially for conda users. This experiment will serve as ["pythonTerminalEnvVarActivation"]the default experience for the 25% of pre-release users behind the experiment flag. You can opt in or out of this experiment by settings.jsonediting in Settings "python.experiments.optInto"or . "python.experiments.optOutFrom"If you have any comments or suggestions about this experience, please share them in vscode-python#11039 .
Insert image description here

Community contributed yapf extension

There is now a community-contributed ( @EeyoreLee ) yapf formatter extension available! This extension provides yapf format support for Python files and jupyter cells. Yapf support built into Python extensions will be deprecated in favor of extension support. Subsequently, the corresponding setting python.formatting.yapfwill be removed from the Python extension.

This corresponds to work announced in August 2022 to break support for the tools provided in the Python extension for Visual Studio Code into separate extensions, with the goal of improving performance and stability, and removing the need to install these tools in the Python environment Medium - as they can be provided with extensions.

Other changes and enhancements

We've also added small user-requested enhancements and fixed issues that should improve your experience using Python and Jupyter Notebooks in Visual Studio Code. Some notable changes include:

We would also like to give a special thanks to this month’s contributors:

Solicit community feedback

As we plan and prioritize future work, we value your feedback! Here are a few questions we would like feedback on:

Try these new improvements by downloading Python extensions and Jupyter extensions 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 encounter any problems or have suggestions, please submit an issue on the Python VS Code GitHub page .

Guess you like

Origin blog.csdn.net/MicrosoftReactor/article/details/132890130