1a3ac0c722
Also adds a formatting script and runs it against all TS files in the samples |
||
---|---|---|
.. | ||
.vscode | ||
src | ||
.vscodeignore | ||
README.md | ||
eslint.config.mjs | ||
package-lock.json | ||
package.json | ||
tsconfig.json |
README.md
Jupyter Kernel Code Execution Sample
This is a very simple extension sample demonstrating the use of the Jupyter Extension API allowing other extensions to execute code against Jupyter Kernels.
- The sample lists finds kernels associated with notebooks that are currently open in the workspace.
- The sample the filters the kernels by language, focusing on Python kernels.
- Upon selecting a Python kernel, code selected by the user is executed against the selected kernel
- The output is displayed in an output panel.
- The sample demonstrates the ability to retrieve outputs of various mime types, including streamed output.
Running this sample
cd jupyter-kernel-execution-sample
code .
: Open the folder in VS Code- Run
npm install
in terminal to install the dependencies - Run the
Run Extension
target in the Debug View. This will:- Start a task
npm: watch
to compile the code - Run the extension in a new VS Code window
- Start a task
- Open a Jupyter Notebook and select a Python kernel and execute some code.
- Select the command
Jupyter Kernel API: Execute code against a Python Kernel
- Select the a Kernel and then select the Code to execute.
- Watch the output panel for outputs returned by the kernel.
Notes:
- Make use of the
language
property of the kernel to ensure the language of the code matches the kernel. getKernel
API can can returnundefined
if the user does not grant the extension access to the kernel.- Access to kernels for each extension is managed via the command
Manage Access To Jupyter Kernels
.