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: Kernel communication upgrade #8024

Closed
3 tasks done
rchiodo opened this issue Oct 25, 2021 · 3 comments
Closed
3 tasks done

Test: Kernel communication upgrade #8024

rchiodo opened this issue Oct 25, 2021 · 3 comments

Comments

@rchiodo
Copy link
Contributor

rchiodo commented Oct 25, 2021

Refs: #7675

Complexity: 4

Create Issue


We've upgraded our internal library we use for communicating with kernels in the Jupyter extension to the latest jupyter lab services API

This version of the npm module looks to be a complete rewrite so we'd like to regression test all forms of communication with jupyter kernels.

Setup steps:

  1. Install some version of python
  2. Make sure you have pip installed
  3. Install Jupyter extension from marketplace (it is updated nightly, so it will have this month's changes in it)
  4. Install insiders Python extension

Test steps: (repeat multiple times)

  1. Create a python environment using either venv or conda. Alternatively you can use an existing environment.
  2. If using conda, try creating environments with different versions of python
  3. Open VS code in a new folder (if using venv, make sure the venv you created is located at the same root)
  4. Create a python file like so:
# %%
print('run cell')
  1. A bunch of code lenses should appear.
  2. Try using all of them
  3. You should be prompted to install ipykernel (if you haven't already)
  4. Try restarting the kernel
  5. Run a cell again, make sure it runs
  6. Run the following cell
import sys
!{sys.executable} -m pip install tqdm
  1. Add another cell like so (through the input box or the python file)
# %%
from tqdm import trange
import time
for i in trange(100):
    time.sleep(0.1)
  1. Make sure you can interrupt running of this cell, by clicking Interrupt at the top of the Interactive-1 editor.
  2. After interrupting make sure the kernel is still usable
  3. Using File | New File ... create a jupyter notebook
  4. Try the interrupt code in the notebook too
  5. Try restarting the kernel in the notebook too.
  6. Opening your settings.json and add this hidden setting:
    "jupyter.disableZMQSupport": true
  1. Rerun the steps above with that setting

Testing remote: (doesn't need to be done multiple times)

  1. On one of the venvs or conda environments you created before, install full jupyter
  2. In a command prompt, switch to your workspace folder
  3. Activate your venv/conda environment
  4. Run jupyter notebook. It should output something like so:
[I 12:12:55.526 NotebookApp] Serving notebooks from local directory: D:\Source\Testing_3
[I 12:12:55.526 NotebookApp] Jupyter Notebook 6.2.0 is running at:
[I 12:12:55.526 NotebookApp] http://localhost:8888/?token=44a6967a96e31890585f51b1d64e50811917ba5d9d555ab3
[I 12:12:55.526 NotebookApp]  or http://127.0.0.1:8888/?token=44a6967a96e31890585f51b1d64e50811917ba5d9d555ab3
[I 12:12:55.527 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:12:55.675 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/aku91/AppData/Roaming/jupyter/runtime/nbserver-10188-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=44a6967a96e31890585f51b1d64e50811917ba5d9d555ab3
     or http://127.0.0.1:8888/?token=44a6967a96e31890585f51b1d64e50811917ba5d9d555ab3
  1. Start VS code in the same workspace folder
  2. Run this command:
    image
  3. Pick Existing on the first quick pick
  4. Copy the URL from your terminal into the second quick pick.
  5. Restart VS code
  6. Run the steps above but use the default 'python 3' kernel (debugging doesn't work just yet)
  7. Make sure interrupt and restart tasks work
@rchiodo rchiodo added the bug Issue identified by VS Code Team member as probable bug label Oct 25, 2021
@rchiodo rchiodo added testplan-item and removed bug Issue identified by VS Code Team member as probable bug needs-triage labels Oct 25, 2021
@joaomoreno
Copy link
Member

joaomoreno commented Oct 26, 2021

Install Jupyter extension from marketplace (it has insiders only versions)

Not sure what this means. I just installed this one: https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter.

Also, after switching to the Python insiders, I eventually got this confusing message. I'm guessing this is a bug on Pylance?

image

@joaomoreno
Copy link
Member

I also had a hard time with

from tqdm import trange <-- This might require you import a new module into the [kernel](https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/#How-to-use-Pip-from-the-Jupyter-Notebook). 

What solved it was

import sys
!{sys.executable} -m pip install tqdm

So I've updated the test plan item steps to tell the user to do just that, instead of linking to an obscure guide about Python/Pip/Jupyter internals.

@joaomoreno
Copy link
Member

Run the steps above but use the default 'python 3' kernel

I've annotated this step, given that Debugging while attached to a remote server is not currently supported.

Overall, it's my first time trying out these ephemeral cells, this is pretty cool! 👏

@joaomoreno joaomoreno removed their assignment Oct 26, 2021
@sbatten sbatten removed their assignment Oct 26, 2021
@paulacamargo25 paulacamargo25 removed their assignment Nov 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2022
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