-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a mechanism for an extension to determine or set a preferred kernel. #4423
Comments
Thanks @brettfo I dont think we'd need any additional VSC API for this. |
At our end the fix woudl be in const kernelSpec = await this.kernelFinder.findKernelSpec(resource, notebookMetadata, cancelToken);
....
....
if (!kernelSpec && activeInterpreter) {
await this.installDependenciesIntoInterpreter(activeInterpreter, ignoreDependencyCheck, cancelToken);
// Return current interpreter.
return {
kind: 'startUsingPythonInterpreter',
interpreter: activeInterpreter
};
} else if (kernelSpec) { To discuss
Note: |
On a related note, is there a way that our extension can set the I tried setting the notebook document's metadata to add the This paired with some hard-coded logic to select our kernel if |
@brettfo You could update the metadata using the VSCode API. Once done, that should work. However I can also see there's a bug at our end, we need to clear the kernel selection when user selects another kenerl (we update the metadata with the last selected Jupyter kernel). |
@DonJayamanne thanks for the metadata pointer, I'm now able to set kernelspec metadata (and any other metadata) and get it serialized on save. So now we just need a way for this document metadata to somehow be mappable to our VS Code kernel when there are no Jupyter kernels installed on disk. E.g., if ...
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"name": ".net-csharp"
}
}
... know to map to the VS Code concept of a kernel with |
In this instance, doesn't this mean the user already has Jupyter kernels installed. |
Changing this to point release so this works for the .NET team's release date. |
@rchiodo Do we have a specific validation here? Did this work for .NET interactive release? If so I would consider that validation. |
For validation: Install both us and .NET interactive. Make sure python and .NET notebooks work. |
@rchiodo Not sure if this is on our side our their side. But currently when I do the command to create a new blank .NET Interactive notebook it pops up and briefly shows C# (.NET Interactive) as the cell language. Then immediately, without changing it manually, it changes to Python. When launching it tries to launch with my current interpreter. |
For an existing notebook that was saved to use the .NET kernel, does that still open and use the .NET kernel? I believe that's what this bug was about. Creating blank notebooks is a separate issue. |
That scenario doesn't work right for me either. It actually does open the saved .NET notebook correctly. But I then opened up a previous saved python notebook of mine. It started up a .net kernel when I opened it, and changed all the cell languages to C#. You can see both kernels starting up in the .Net interactive log. VariableTest.ipynb is a python notebook that I use frequently that has a saved kernelspec. |
@rchiodo Preference on me pulling this back to backlog versus resolving it (since the saved .NET file does open and use the .NET kernel) and opening a new issue for the issue above? |
That last part is the bug then. That's what is supposed to work. We should open a new bug on .NET interactive to fix that. |
I think we would then mark this bug as upstream. |
Sorry, didn't get around to looking at this until after lunch. I see the same behavior on stable VS Code with our release branch bits. Still sounds like from what you said it's upstream either way, so I'll file an issue. |
As a corollary to #4363, there should be a way for a VS Code concept of a kernel to map to an existing
.ipynb
file without requiring an installed kernelspec file. E.g., consider a situation where a user installs this extension as well as the .NET Interactive extension. From there they open an existing.ipynb
file. At that point, there is no mechanism for the VS Code version of the .NET Interactive kernel to be auto-selected.This issue is hopefully more of a discussion about how to add this functionality, and the end result may require changes from VS Code itself.
As a single data point, if a new
.ipynb
notebook is created, the kernel set to .NET Interactive and it's saved, the notebook's metadata looks like this:The text was updated successfully, but these errors were encountered: