Python in Visual Studio Code – September 2023 Release

We’re excited to announce the September 2023 release of thePython andJupyter extensions for Visual Studio Code!
This release includes the following announcements:
- “Recreate” or “Use Existing” options added to thePython: Create Environment command
- Experimental terminal activation using environment variables
- Community-contributed yapf extension
If you’re interested, you can check the full list of improvements in our changelogs for thePython,Jupyter, andPylance extensions.
“Recreate” or “Use Existing” options when usingPython: Create Environment with existing.venv
When working within a workspace that already contains a.venv
folder, thePython: Create Environment command has been updated to provide you with options to either recreate or use the existing environment. If you opt-in to recreate the environment, your current.venv
will be deleted, allowing you to recreate a new environment named.venv
. You can customize this new environment by following thePython: Create Environment flow, selecting your preferred interpreter, and specifying any dependency files for installation. In the case the environment cannot be deleted, for example, due to it being active, you will be prompted to delete the environment manually.
Alternatively, if you opt to use the existing environment, the environment will be selected for your workspace.
Experimental terminal activation using environment variables
This month, we are beginning the rollout of terminal activation using environment variables that activate the selected environment in the terminal without requiring any activation commands. With this new experience, the Python extension uses environment variables to activate terminals, which is done implicitly on terminal launch, resulting in a faster experience, particularly for conda users. This experiment will serve as the default experience for 25% of Pre-release users behind the experimental["pythonTerminalEnvVarActivation"]
flag. You can opt into or out of this experiment in yourUser settings by modifying"python.experiments.optInto"
or"python.experiments.optOutFrom"
respectively in yoursettings.json
. If you have any comments or suggestions regarding this experience, please share them invscode-python#11039.
Community-contributed yapf extension
There is now a community-contributed (@EeyoreLee)yapf formatter extension available! This extension provides yapf formatting support for Python files and Notebook cells. Yapf support built into the Python extension will be deprecated in favor of the extension support. Subsequently, the corresponding settingpython.formatting.yapf
will be removed from the Python extension.
This corresponds to the workannounced in April 2022 to break out the tools support we offer in the Python extension for Visual Studio Code into separate extensions, with the intent of improving performance, and stability and no longer requiring the tools to be installed in a Python environment – as they can be shipped alongside an extension.
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:
- Unresolved import errors now indicate in which environment Pylance is looking for packages (pylance-release#4368)
- There’s a new experimental setting called
python.analysis.enableSyncServer
that enables multi-file IntelliSense support invscode.dev. Support forgithub.dev and virtual workspaces is coming soon! - Pylance no longer crashes on Jupyter Notebook cell deletion (@pylance-release#4685)
- There is a new dedicated topic onPython formatting in our docs where you’ll learn how to set a default formatter such asautopep8 orBlack formatter and customize it through various settings.
We would also like to extend special thanks to this month’s contributors:
- @chrissiwaffler made their first contribution invscode-python-tools-extension-template#126
- @oliversen made their first contribution invscode-python-tools-extension-template#145
- @EeyoreLee made their first contribution invscode-python-tools-extension-template#155
- @rachfop made their first contribution invscode-python-tools-extension-template#41
- @34j made their first contribution invscode-python-tools-extension-template#59
- @augb made their first contribution invscode-python-tools-extension-template#72
- @eddyg made their first contribution invscode-python-tools-extension-template#84
- @ischaojie made their first contribution invscode-python-tools-extension-template#92
Call for Community Feedback
As we are planning and prioritizing future work, we value your feedback! Below are a few issues we would love feedback on:
- Future Design of Python Testing Output(vscode-python#21861)
Try out these new improvements by downloading thePython extension and theJupyter 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 aboutPython support in Visual Studio Code in the documentation. If you run into any problems or have suggestions,please file an issue on thePython VS Code GitHub page.
Author
