question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Read metadata from kernelspec files to map to VS Code kernels.

See original GitHub issue

As mentioned in this comment, the experience with .NET Interactive notebooks would benefit greatly if certain Jupyter kernels could be hidden from the user on kernel select AND if this same mechanism could be used to assign the appropriate kernel on notebook open.

E.g.,

If the C# kernelspec added this:

...
"metadata": {
    "vscode-extension": "ms-dotnettools.dotnet-interactive-vscode"
}
...

Then we’d like the kernel selector list to only show the in-memory VS Code kernel (as exposed by registerNotebookKernelProvider) because the extension that provides that kernel happens to match the vscode-extension metadata value.

Without this the user is shown 4 different kernels: “.NET (C#)”, “.NET (F#)”, “.NET (PowerShell)”, and “.NET Interactive”, but this can be confusing and not give a great experience. The first 3 kernels are Jupyter-specific kernelspec files and offer the basic Jupyter functionality, but if the last option of “.NET Interactive” is selected, then the user will also get rich IntelliSense, etc.

I’m not too concerned about the final name of vscode-extension; we’ll leave that decision up to you to decide.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Jan 15, 2021

Thanks, here’s the revised condition (hide only if .NET interactive extension is available in VS Code)

if (jupyterKernel.metadata.vscode.extension_id === vscodeKernel.extension.id &&
    jupyterKernel.metadata.vscode.kernel_id === vscodeKernel.id && vscode.extensions.getExtensions('ms-dotnettools.dotnet-interactive-vscode)) {
    // suppress the display of this jupyter kernel, because it has an equal coming from vs code
}
1reaction
brettfocommented, Jan 14, 2021

I chatted with my team and we think the best approach will be my most recent suggestion of:

...
"metadata": {
    "vscode": {
        "extension_id": "ms-dotnettools.dotnet-interactive-vscode",
        "kernel_id": "dotnet-interactive"
    }
}
...

I should note, however, that when you’re testing locally, you’ll need to set kernel_id to undefined because the current version of our extension doesn’t set the kernel ID, but in the future we’ll set it to "dotnet-interactive" and we’ll be sure to update our kernelspec files with the same change.

E.g.,

if (jupyterKernel.metadata.vscode.extension_id === vscodeKernel.extension.id &&
    jupyterKernel.metadata.vscode.kernel_id === vscodeKernel.id) {
    // suppress the display of this jupyter kernel, because it has an equal coming from vs code
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Making kernels for Jupyter — jupyter_client 7.4.8 documentation
Making kernels for Jupyter . A 'kernel' is a program that runs and introspects the user's code. IPython includes a kernel for...
Read more >
vscode jupyter failed to start kernel - Stack Overflow
1 Answer 1 · Launch an instance of anaconda prompt · Type pip install -U ipykernel --user and hit enter · Switch to...
Read more >
Working with Jupyter Notebooks in Visual Studio Code
Work with Jupyter code cells; View, inspect, and filter variables using the Variable Explorer and Data Viewer; Connect to a remote Jupyter server;...
Read more >
src/Jupyter/Install/Internal.hs - Hackage
Internal Description : Utilities for installing Jupyter kernels (internal ... (required) JSON file containing kernel invocation command and other metadata.
Read more >
Tutorial: Set up a Jupyter notebook in JupyterLab to test and ...
AWS Glue tutorial that shows how to connect a Jupyter notebook in JupyterLab running on your ... jupyter-kernelspec install sparkmagic/kernels/sparkkernel ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found