Python in Visual Studio Code – March 2019 Release

Luciana Abud

We are pleased to announce that the March 2019 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 made a series of improvements that are listed in our changelog, closing a total of 52 issues that includes: 

  • Live Share support in the Python Interactive Window 
  • Support installing packages with Poetry 
  • Improvements to the Python Language Server 
  • Improvements to the Test Explorer 

 Keep on reading to learn more! 

Live Share for Python Interactive  

Real-time collaboration is made easy with Visual Studio Live Share – it provides you with the ability to co-edit and co-debug while sharing audio, servers, terminals, diffs, comments, and more.  

In this update, the Python Interactive window has been enhanced to participate in Live Share collaboration sessions, making it possible to collaboratively explore and visualize data. Whether you are conducting a code review, pair programming with a teammate, participating in a hack-a-thon, or even teaching an interactive lecture, Live Share can support you in the many ways you collaborate. 

This feature requires the Live Share extension for VS Code to be installed on host and guest machines.

Support installing packages with Poetry  

This new release also adds the ability to use Poetry in Visual Studio Code with the Python extension, a dependency manager that allows you to keep the project’s development dependencies separate from production ones. Poetry support in the Python extension was a highly requested feature on our GitHub repository.

To try out this new feature, first make sure you have Poetry installed as well as the correspondent lock file generated. You can refer to the documentation to learn how to get started with Poetry. Then add the path to Poetry in your settings (through File > Preferences > Settings and searching for Poetry or adding “python.poetryPath”: “path/to/poetry” to your settings.json file). 

Now when you install a new package, it’ll use the provided Poetry path to install them:

Improvements to the Python Language Server

This release includes significant enhancements made to the Python Language Server, which was largely re-written and includes improvements on performance, memory usage and information display, support for relative imports and implicit packages, and understanding of typing, generics, PEP hints and annotations. And now it also offers auto-completion for f-strings and type information when you hover over sub-expressions:

As a reminder, the Language Server was released as a preview the last July release of the Python extension. To opt-in to the Language Server, change the python.jediEnabled setting to false in File > Preferences > User Settings. Since large changes were made to code analysis, there’s a list of known issues introduced that we are currently fixing. If you run into different problems, please file an issue on the Python Language Server GitHub page. We are working towards making the language server the default in future releases.

Improvements to the Test Explorer

On the last February release of the Python extension we added a built-in Test Explorer, that can be accessed through the Test beaker icon on the Activity Bar when tests are discovered in the workspace.

In this release we made improvements to the Test Explorer, including support for multi-root workspaces, parametrized tests and new status icons. The status icons allow you to quickly visualize which tests files or suites have failed without needing to expand the tree.

As a reminder, you can try the Test Explorer out by running the command Python: Discover Unit Tests from the Command Palette (View > Command Palette). If the unit test feature is disabled or no test framework is configured in the settings.json file, you’ll be prompted to select a framework and configure it. Once tests are discovered, the Test Explorer icon will appear on the Activity Bar.

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:

  • Fixed stopOnEntry not stopping on user code (#1159)
  • Support multiline comments for markdown cells (#4215)
  • Update icons and tooltip in test explorer indicating status of test files/suites (#4583)
  • Added commands translation for polish locale. (thanks pypros) (#4435)

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.

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • duxerwhere@gmail.com 0

    wow now the language server uses 2 full cores instead of 1 and 15 gb of memory instead of 5. thanks for the improvements

Feedback usabilla icon