We are pleased to announce that the January 2020 release of the Python Extension for Visual Studio Code is now available. You can download the Python extension from the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about Python support in Visual Studio Code in the documentation.
In this release we addressed 59 issues, including:
- Kernel selection in Jupyter Notebooks
- Performance improvements in the Jupyter Notebook editor
- Auto-activation of environments in the terminal on load (thanks Igor Aleksanov!)
- Fixes to rebuilding ctags on save and on start
If you’re interested, you can check the full list of improvements in our changelog.
Kernel selection in Jupyter Notebooks
In the top right of the Notebook Editor and the Interactive Window, you will now be able to see the current kernel that the notebook is using along with the kernel status (i.e. whether it is idle, busy, etc…). This release also allows you to change your kernel to other Python kernels. To change your current active kernel, click on the current kernel to bring up the VS Code kernel selector and select which kernel you want to switch to from the list.
Performance improvements in the Jupyter Notebook editor!
This release includes many improvements to the performance of Jupyter in VS Code in both the Notebook editor and the Interactive Window. This was accomplished through caching previous kernels and through optimizing the search for Jupyter. Some of the significant improvements due to these changes are:
- Initial starting of the Jupyter server is faster, and subsequent starts of the Jupyter server are more than 2X faster
- Creating a blank new Jupyter notebook is 2X faster
- Opening Jupyter Notebooks (especially with a large file size) is now 2x faster
Note: these performance calculations were measured in our testing, your improvements may vary.
Auto-activation of environments in the terminal on load
When you have a virtual or conda environment selected in your workspace and you create a new terminal, the Python extension activates the selected environment in that new terminal. Now, this release includes the option of having environments to be auto activated in an already open terminal right when the Python extension loads.
To enable this feature, you can add the setting “python.terminal.activateEnvInCurrentTerminal“: true to your settings.json file. Then when the extension loads and there’s a terminal open in VS Code, the selected environment will be automatically activated.
Fixes to rebuilding ctags on save and on start
The ctags tool is responsible for generating workspace symbols for the user. As a result, the document outline becomes populated with file symbols, allowing you to easily find these symbols (such as functions) within your workspace.
This release includes a fix for the most upvoted bug report on our GitHub repo (GH793), related to ctags. Now, tags stored in the .vscode folder for your project can be rebuilt when the Python extension loads by setting “python.workspaceSymbols.rebuildOnStart” to true, or rebuilt on every file save by setting “python.workspaceSymbols.rebuildOnFileSave” to true.
You can learn more about ctags support in our documentation.
Other Changes and Enhancements
We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. Some notable changes include:
- Support the ability to take input from users inside of a notebook or the Interactive Window. (#8601)
- Support local images in markdown and output for notebooks. (#7704)
- Support saving plotly graphs in the Interactive Window or inside of a notebook. (#7221)
- Use “conda run” when executing Python and an Anaconda environment is selected. (#7696)
- Activate conda environment using path when name is not available. (#3834)
- Add QuickPick dropdown option to Run All/Debug All parametrized tests. (thanks to Philipp Loose) (#5608)
We’re constantly A/B testing new features. If you see something different that was not announced by the team, you may be part of the experiment! To see if you are part of an experiment, you can check the first lines in the Python extension output channel. If you wish to opt-out of A/B testing, you can open the user settings.json file (View > Command Palette… and run Preferences: Open Settings (JSON)) and set the “python.experiments.enabled” setting to false.
Be sure to download the Python extension for Visual Studio Code now to try out the above improvements. If you run into any problems, please file an issue on the Python VS Code GitHub page.
Very nice. But I have one request. How can I only clear output from a single cell instead of all cells or collapse a cell (output)?
Why only python kernels available? When could we expect integration with other language kernels like c#?
Hey there! Details and updates about this specific feature request can be found on this issue: https://github.com/microsoft/vscode-python/issues/5078. Thanks!
For someone who just wishes to minimally run Jupyter Notebook using VS Code (instead of using a browser), please provide simple step-by-step instructions, starting from installation of VS Code. As it is, following https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites leads to plenty of unresolved error messages, even when started from a clean computer with no prior version of Python. A one-click solution like Anaconda would be even better! Please try to win Jupyter people to VS Code....
Hi, we are currently working on a step by step tutorial to Jupyter Notebooks in VS Code that should be published sometime soon. In the meantime, the Jupyter Notebooks in VS Code documentation would be your best bet on instructions for using Jupyter Notebooks in VS Code. Thank you for your suggestions!
To use the Jupyter Notebook you need to add # %% on top of the code, but you need to have the Python extension installed.