Python in Visual Studio Code – June 2024 Release

Courtney Webster

We’re excited to announce the June 2024 release of the Python and Jupyter extensions for Visual Studio Code!

This release includes the following announcements:

  • VS Code Native REPL for Python with Intellisense and syntax highlighting
  • Pytest improvements in the testing rewrite

If you’re interested, you can check the full list of improvements in our changelogs for the Python, Jupyter and Pylance extensions.

VS Code Native REPL for Python with Intellisense and syntax highlighting

Starting in this release, we are experimenting with a new REPL in the Python extension which includes features such as Intellisense and syntax highlighting to make your Python development experience more efficient. For those familiar with Jupyter’s Interactive Window, this REPL may look similar; however, it has two key differentiators: it does not rely on the Jupyter extension, nor does it require a kernel to be installed in your development environment. This VS Code Native REPL for Python also adheres to principles present in the REPL built-in to Python itself, in that history is immutable.

To enable this feature, set "python.REPL.sendToNativeREPL": true in your settings.json file. This will execute code in the VS Code Native REPL on Shift+Enter and Run Selection/Line. Moreover, the Native REPL will smartly execute on Enter, similar to Python’s original interactive interpreter, if you add the setting "interactiveWindow.executeWithShiftEnter": false, in your settings.json. You can opt to continue to use the REPL built-in to Python located in the terminal ( >>> ) by setting "python.REPL.sendToNativeREPL": false in your settings.json.

As we continue iterating on this feature, all feedback is welcomed and can be made as issues in our GitHub repository.

Gif of Python Native REPL with Intellisense and syntax highlighting.

Pytest improvements in the testing rewrite

The experience with pytest when using the Python Testing Rewrite has been improved to better support setting pytest’s cwd (current working directory) when it is adjacent to the VS Code workspace root, and for displaying parameterized tests on the Test Explorer when function names are repeated across classes. Additionally, we reduced test discovery failure scenarios by adding the system configuration script path to PATH to enable shells for test execution.

As we continue to add improvements to the testing experience under the rewrite to make the experience more stable and performant, we will begin adopting the rewrite as default in the upcoming month on pre-release of the Python 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:

  • You can now enable/disable auto-indent with Pylance without having to restart the server (pylance-release#5778)
  • “Implement all inherited abstract classes” Code Action is now available as a Quick Fix for the reportAbstractUsage diagnostic (pylance-release#5757)

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

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:

Try out these new improvements by downloading the Python extension and the Jupyter 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 about Python support in Visual Studio Code in the documentation. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.


Leave a comment

Feedback usabilla icon