Skip to content

Enhancement: Preferred kernel auto picking #146339

@rebornix

Description

@rebornix

Currently in VS Code when users open a notebook document, they don't need to pick a kernel manually only in following two scenarios:

  • The notebook was opened before and users run the notebook against a kernel already. That kernel will be picked automatically, no other kernel would replace it unless users pick one manually.
  • There is only one kernel contributed to this notebook.
    • When users run a cell, and there is still only one kernel, the kernel will be used.
    • Before users run any cell, and there are more than one kernel, the kernel picker will not show any active kernel info (it shows "Select kernel" instead).

Above two scenarios cover two use cases: open an existing notebook, or work on single controller notebook (e.g., GitHub issue notebook). However this doesn't cover two common workflow

  1. Users open their existing Jupyter notebook (created through other Jupyter frontend/service) in VS Code
  2. Users create new Jupyter notebooks when they have already specified their preferred kernel

Especially that VS Code is still growing to be one of data scientists' Jupyter frontend/editor, almost every new users will run into workflow 1 and do manual kernel picking though often Jupyter has a good guess which kernel is preferred for current document, and also every existing would run into workflow 2.

The concrete issues reported:

  1. [AZML/Open in VS Code] on AZML website, click open in VS Code, it opens a remote window and opens the notebook document in the editor. No kernel is not picked though users already specify one in AZML website.
  2. Create notebook A in File Explorer, pick a kernel. Create notebook B in File Explorer, the kernel info is back to "Select Kernel" again. Notebooks - Create new notebook not honoring default kernel  #134830 (comment)
  3. Create untitled notebook in Editor Area, pick a kernel and run. Save as a new notebook document on disk, the new document has no selected kernel. Notebooks - Kernel Not Saved vscode-jupyter#9512
  4. Julia. Create a notebook in JuliaLab, specify a kernel. Open the notebook then in VS Code, preferred kernel not selected. The kernel selection UI should not appear if only one notebook controller is marked as preferred #131370

Proposals

For AZML/Julia users, they are mostly working on single language notebook (other than polyglot), meaning the notebook serializer is the ipynb extension we ship out of the core, and kernels/controllers are contributed by a single notebook extension installed from the marketplace (Julia, or .NET, or Jupyter). If this is the case, we can pick the kernel whose affinity is the only highest without prompting users to pick one.

cc @jrieken @mjbvz @DonJayamanne @roblourens

Metadata

Metadata

Assignees

Labels

insiders-releasedPatch has been released in VS Code Insidersnotebook-executionIssues related to running cells in a notebookunder-discussionIssue is under discussion for relevance, priority, approach

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions