Skip to content
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

Test Jupyter Kernel Execution API #14787

Closed
3 of 21 tasks
DonJayamanne opened this issue Nov 27, 2023 · 1 comment
Closed
3 of 21 tasks

Test Jupyter Kernel Execution API #14787

DonJayamanne opened this issue Nov 27, 2023 · 1 comment

Comments

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Nov 27, 2023

Refs: #14669

Complexity: 5

Create Issue


Pre-Requisites

  • Ability to run a Jupyter Notebook against a local Python kernel
  • Ability to run a Jupyter Notebook against a remote Python kernel

Steps

Review the Kernel API

  • Review the API Jupyter.kernels, Jupyter.kernels.getKernel, <Kernel>.executeCode

Verify Access to Kernel API

  • First open a notebook, run code against a Python kernel (local/remote)
  • Use the API method Jupyter.kernels.getKernel(< URI of notebook > to get the kernel
  • Verify the user is prompted to grant access to this kernel
  • Click cancel.
  • Verify a kernel is not returned in the API call
  • Select the command Manage Access to Jupyter Kernels
    • Verify your extension is displayed in the list
    • Verify your extension is NOT ticked
  • Tick your extension from the list
  • Go back to your extension code and invoke the getKernel API again
    • Verify a prompt is not displayed
    • Verify a Kernel instance is returned via the API
  • Select the command Manage Access to Jupyter Kernels
    • Verify your extension is displayed in the list
    • Verify your extension is ticked
  • Un-Tick your extension from the list
  • Go back to your extension code and invoke the getKernel API again
    • Verify a prompt is not displayed
    • Verify a Kernel instance is NOT returned via the API
  • Reload VS Code
    • Run code against the open notebook
    • Verify calling getKernel from the extension will display the prompt
    • Click OK
    • Verify the Kernel instance is returned
  • Reload VS Code
    • Run code against the open notebook
    • Verify calling getKernel from the extension will NOT display the prompt
    • Verify the Kernel instance is returned

Verify Execution of Code to Kernel API

  • First open a notebook, run code against a Python kernel (local/remote)
  • Access the Kernel via the getKernel API call
  • Verify you can execute code such as print("Hello World") via the API and you get the output back
  • Verify you can execute code such as for i in range(10):\n import time\n time.sleep(1)\n print(i) via the API and you get 10 outputs back one by one (i.e. verify outputs are streamed as they arrive)
  • Verify code is executed against the right Kernel when you have two notebooks with different kernels.
@DonJayamanne
Copy link
Contributor Author

@amunger @rebornix @Yoyokrazy
If you run into this error, then please edit the api.d.ts file and comment those two lines
image

@rebornix rebornix removed their assignment Nov 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants