We are pleased to announce that the October 2018 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. You can learn more about Python support in Visual Studio Code in the documentation.
In this release we have closed a total of 49 issues, including:
Keep on reading to learn more!
The extension now contains new editor-centric interactive programming capabilities built on top of Jupyter. To get started, make sure to have Jupyter installed in your environment (e.g. set your environment to Anaconda) and type #%% into a Python file to define a Cell. You will notice a “Run Cell” code lens will appear above the #%% line:
Clicking Run Cell will open the Python Interactive window to the right and run your code. You can define further cells or press Shift+Enter to run the current cell and automatically create a new one (or advance to the next cell).
Separately, if you were to open a Jupyter Notebook file (.ipynb), you will now be prompted to import the notebook as Python code:
Cells in the Jupyter Notebook will be converted to cells in a Python file by adding #%% lines. You can run the cells to view the notebook output in Visual Studio code, including plots:
Check out our blog post Data Science with Python in Visual Studio Code for a deep dive of the new capabilities!
When stopped at a breakpoint and typing expressions into the debug console, you now get completions appearing:
Completions are based on variables available at runtime in the current scope.
The Python extension will now detect new virtual environments that are created in your workspace root while Visual Studio Code is running. You can create virtual environments from the terminal, and they are immediately available to select by clicking on the interpreter selector in the status bar, or by using the Python: Select Interpreter command.
In the screenshot above a new virtual environment named “env” was created in the terminal, and then set the active environment, as indicated by ‘env’ in the status bar. Previously you had to reload Visual Studio Code for the new environment to be available.
We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. The full list of improvements is listed in our changelog; some notable changes include: