VS Code Python Tool Does Multiple Interactive Windows

On Halloween 2018 a developer filed an issue in the GitHub repo for the VS Code Python extension, asking for the ability for users to "spin up multiple 'Python Interactive' windows."

In August 2020, the functionality requested in that issue was officially announced.

"By default, every time you run the 'Python: Create Python Interactive Window' command in the command palette (View > Command Palette ...), it will create a new interactive window in VS Code," said Savannah Ostrowski, program manager, in an Aug. 13 blog post.

"Code cells from Python scripts by default will still be executed in a same interactive window. However, you can now configure the Python extension to run separate files in separate interactive windows. Just open the settings page (File > Preferences > Settings), search for 'interactive window mode' and change the setting value to 'perFile.' Now when you run cells from different files, they will each run on their own separate window."

Multiple Interactive Windows in Action
[Click on image for larger, animated GIF view.] Multiple Interactive Windows in Action (source: Microsoft).

Of course, developers who prefer the single interactive window behavior can opt to retain it with a simple configuration tweak.

The August 2020 update to Python in VS Code also includes support for Pylance, a new Python language server that uses the Language Server Protocol to communicate with VS Code and provide programming "smartness" specific to the popular language, such as autocomplete and smart completions (IntelliSense), error-checking (diagnostics), jump-to-definition, linting and corrections, find all references and so on.

Pylance in Animated Action
[Click on image for larger, animated GIF view.] Pylance in Animated Action (source: Microsoft).

Its marketplace listing says that it provides the following features for Python 3:

  • Docstrings
  • Signature help, with type information
  • Parameter suggestions
  • Code completion
  • Auto-imports (as well as add and remove import code actions)
  • As-you-type reporting of code errors and warnings (diagnostics)
  • Code outline
  • Code navigation
  • Type checking mode
  • Native multi-root workspace support
  • IntelliCode compatibility
  • Jupyter Notebooks compatibility

Pylance, named after a character created by the British Monty Python surreal comedy troupe, can be downloaded from the VS Code Marketplace or installed via a configuration setting.

When we first reported on Pylance on July 1, the Pylance extension was nearing 4,000 installations. Now, at the time of this writing, it's nearing 88,000 installations

The new update to the VS Code Python extension also improves Pylance functionality, specifically related to how it displays signature help when a developer invokes a function with multiple overrides. "You can now navigate between signatures easily while Pylance bolds the appropriate active parameter," Ostrowski said.

A few other highlights called out in today's post include:

  • Cell editing shortcuts for python interactive cells that help make doing data science work directly in Python files even more productive (thanks to @earthastronaut!). (#12414)
  • Added a command to restart the language server. (#3073)
  • Update to the latest version of jedi (0.17.2). This adds support for Python 3.9 and fixes some bugs, but is expected to be the last release to support Python 2.7 and 3.5. (thanks Peter Law). (#13037)
Microsft's Python extension is by far the most popular item in the VS Code Marketplace, with some 23.4 million installations. The company years ago went "all in" on Python for VS Code, to the extent of even hiring the extension's creator, Don Jayamanne.

The full list of changes in the update can be found in the changelog, and developers can learn more about  Python support in Visual Studio Code  in the documentation.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


  • Decision Tree Regression from Scratch Using C#

    Dr. James McCaffrey of Microsoft Research says the technique is easy to tune, works well with small datasets and produces highly interpretable predictions, but there are also trade-off cons.

  • Visual Studio 'Tea & Technology' Video Miniseries Starts Next Week

    The goal of the miniseries is to provide an insider's snapshot look at some of the people who contribute to shaping the Visual Studio IDE every day.

  • Microsoft Releases OpenJDK 21 Build for Java Jockeys

    Microsoft today announced its "Microsoft Build of OpenJDK 21," taking advantage of new features and functionality in Java 21.

  • 'Dev Home' Update Leads Developer Goodies in AI-Powered Windows 11 Update

    Along with today's new AI-powered Windows 11 update come new goodies for developers, including a new edition of Dev Home, a preview offering described as a "control center" providing coding-focused features and functionality.

Subscribe on YouTube