-
Notifications
You must be signed in to change notification settings - Fork 295
Accessing Jupyter Kernels from 3rd party extensions
Third party extensions can now enumerate all of the Jupyter kernels, start a kernel and execute code against the kernels. The API kernel exposed conforms to the Kernel.IKernelConnection API provided by @jupyter/services package found here
The API exposed provides the following functionalities:
- Enumerate kernel specifications
- Enumerate active kernels (local and remote)
- Ability to connect to an active kernel (remote)
- Ability to start a kernel
- Ability to get an instance of the active kernel as Kernel.IKernelConnection
All of the types are exposed in the following type definition file
The API is currently available to all extension authors while debugging VS Code extensions. However extensions can only use this API in VS Code insiders, and must register with the Jupyter extension (by reaching out to us). This is only done so that we don't break 3rd party extensions when changing this API, hence we request all extension authors to register with us to work closely for a smoother experience for extension authors and end users. Currently the list of extensions (publishers) allowed to access this API is defined in here https://github.com/microsoft/vscode-jupyter/blob/main/src/client/api/apiAccessService.ts#L22 and the plan is to update this over time.
Once the API is stable enough, we'll consider exposing for use in VS Code Stable.
import { extensions } from 'vscode';
const jupyter = extensions.getExtension<JupyterApi>('ms-toolsai.jupyter');
await jupyter.activate();
const kernelService = await jupyter.exports.getKernelService();
// Use the methods in kernelService
kernelService.start(.....)
- Contribution
- Source Code Organization
- Coding Standards
- Profiling
- Coding Guidelines
- Component Governance
- Writing tests
- Kernels
- Intellisense
- Debugging
- IPyWidgets
- Extensibility
- Module Dependencies
- Errors thrown
- Jupyter API
- Variable fetching
- Import / Export
- React Webviews: Variable Viewer, Data Viewer, and Plot Viewer
- FAQ
- Kernel Crashes
- Jupyter issues in the Python Interactive Window or Notebook Editor
- Finding the code that is causing high CPU load in production
- How to install extensions from VSIX when using Remote VS Code
- How to connect to a jupyter server for running code in vscode.dev
- Jupyter Kernels and the Jupyter Extension