VS Code Python Tool Revamps Jupyter Notebooks Experience

The August 2021 release of the Python Extension for Visual Studio Code completes a revamp of the Jupyter Notebooks experience that was started more than a year ago.

That experience is said to be faster and more feature-rich thanks to leveraging the Native Notebooks API in order to improve data science coding.

The Notebook API
[Click on image for larger view.] The Notebook API (source: Microsoft).

The effort started in July 2020, when the dev team for the Python extension for Visual Studio Code announced the Native Notebook project, promising these benefits:

  • Improved integration between extensions in notebooks: Developers can now use the same extensions for editing source code or markdown text in the VS Code Editor from within notebooks "For example, you won't miss your VIM key bindings or your stylishly colored brackets anymore."
  • Improved load times: This is illustrated by an example notebook that builds and assesses the accuracy of an image recognition model that differentiates between dog breeds contains 49 code cells, 18 markdown cells, and their outputs (~5MB). "The current notebook editor takes about 7 seconds to open this notebook, but the new notebook editor takes less than a second!"
  • New interface: This sports a fresh look and feel along with other UI changes and cell manipulation capabilities that match VS Code's design language.

In a new post last week about the August 2021 release of the extension, the team said the Native Notebook experience is out of preview, noting these improvements:

  • Source control diffing: cell changes are now easier to parse and to inspect in the source control view -- you can even customize what types of changes you want displayed.
  • Key-bindings: default VS Code shortcuts as well as those provided by keymap extensions (e.g. VIM) are now supported on notebook files.
  • High customization ability: customization of appearance or placement of many of the UI notebook elements -- you can check all available settings by opening the Settings UI (File > Preferences > Settings and search for "Notebook."
Native Notebooks in Animated Action
[Click on image for larger, animated GIF view.] Native Notebooks in Animated Action (source: Microsoft).

Jupyter Notebooks functionality was also improved by the VS Code dev team, which last week announced several enhancements to the open source-based, cross-platform code editor. For one thing, the team moved some code from the dedicated Jupyter Notebook extension to an internal, built-in extension, so *ipynb files can now be opened with a clean, bare-bones VS Code installation. However, some functionality, like executing cells or view outputs that have complex renderer types, like ipywidgets, will require installing the Jupyter extension.

The Python extension dev team said the August 2021 release was a "short release" because the tool's release cadence was being adjusted to match that of VS Code. Thus the only other feature of special note was improved sorting of Python interpreters.

"Previously, when running the 'Python: Select Interpreter' command, the Python extension would display the list of all the Python interpreters it could find ordered alphabetically," Microsoft said. "When there are many Python environments on a machine, this often led to additional steps for interpreter selection that involved searching and a lot of scrolling. To make that process faster, we are now displaying the list of interpreters in a way so that the one you are most likely to want for your project shows first on the list and is easier to find."

More on what's new for August 2021 can be found in the changelog for the extension, which at more than 40 million installations is by far the most popular tool in the VS Code Marketplace, way ahead of No. 2 C/C++ with about 22 million downloads. The Jupyter extension is close behind in third place at about 19.5 million installations, speaking to the enormous popularity of VS Code in the data science space.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


Subscribe on YouTube