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 built-in interactive window #127378

Closed
3 tasks done
joyceerhl opened this issue Jun 28, 2021 · 0 comments
Closed
3 tasks done

Test built-in interactive window #127378

joyceerhl opened this issue Jun 28, 2021 · 0 comments

Comments

@joyceerhl
Copy link
Contributor

joyceerhl commented Jun 28, 2021

Refs: #126415

Complexity: 4

Authors: @rebornix, @joyceerhl

Create Issue


Setup

(Jupyter extension will auto-publish its endgame insiders build at ~2.30am PST daily, i.e. around noon in Zurich. Any Zurich-based team members should hold off on going through this test plan item before noon)

  1. Close VS Code Insiders
  2. (If you don't already have Python 3 installed) Install Python 3 from https://www.python.org. Recommended changes to default installer configurations: install it just for the current user and add it to PATH (you can uninstall Python later)
  3. (If you don't already have the Python modules, ipykernel and nbconvert, installed) Run python -m pip install ipykernel nbconvert (dependency for starting Python Jupyter kernels)
  4. Open VS Code Insiders from the start menu
  5. Install the Jupyter extension or ensure that you do not have any pending extension updates for the Jupyter extension
  6. Install the Python extension (this should also install the Pylance extension and set "python.languageServer": "Pylance")
  7. Opt into the Python Daily Insiders channel using the 'Python: Switch to Insiders Daily Channel' command palette command. This will download the latest insiders build of the Python extension, which you will need for language server integration
  8. In your settings.json, add "jupyter.enableNativeInteractiveWindow": true and ensure that you don't have "jupyter.experiments.enable": false or "jupyter.experiments.optOutFrom": ["All"]. You may need to reload VS Code for the settings to take effect if the Jupyter extension has activated at this point

Summary

The interactive window is an existing feature in the Jupyter extension which acts as a readonly debug console / REPL with support for executing code and markdown cells and rendering rich MIME outputs, backed by a Jupyter kernel. Unlike Jupyter notebooks, the interactive window does not support out of order execution of cells.

In this iteration we worked on porting the interactive window to use a new UI provided by VS Code core. The purpose of this test plan item is to ensure that the majority of functionality in the interactive window continues to work after the port and to get feedback on the experience we have implemented so far.

Known issues

  • Undo/redo in the interactive window has not been implemented yet
  • Diagnostics are not closed on interactive window dispose (existing issue for native notebooks as well)

What we're trying to verify

NB: Please file all bugs found when testing the following behaviors on https://github.com/microsoft/vscode-jupyter. Please feel free to file issues with any suggestions you have for how we can make the interactive window more useful as well. Thank you 😊

Interactive window creation

  1. Entrypoints:
    1. Entrypoint 1: tied to an active file
      • Use the 'Python: Select Interpreter' command to select the Python interpreter you just installed
      • Create a new Python file
      • Add #%% to the Python file to create interactive cells (each #%% on a newline corresponds to a new cell)
      • Type some Python code below a #%% cell marker e.g. foo = 42
      • Codelenses and horizontal line decorations delimiting the current cell should appear above #%%
      • Use the codelenses or the Jupyter extension-contributed shift+enter keybinding, to run the current cell in the interactive window
      • You can use #%% [markdown] to create a markdown cell in the Python script, IPython script-style. The contents of the #%% cell are regular markdown syntax where each line is prefixed with a #. These cells can be executed in the interactive window in the same way
      • When you use codelenses or keybindings to execute a #%% cell in the interactive window, focus should never leave the Python file text editor
    2. Entrypoint 2: standalone
      • Open the command palette and execute the 'Jupyter: Create Interactive Window' command
  2. In the top right corner, a controller should already be picked which matches the active Python interpreter selection (NB: this is by design for now, because 92.9% of existing interactive window users use the interactive window together with a Python file and hence they will expect the interactive window to respect the active selected Python environment)
  3. The interactive window should open in the editor group next to the currently active editor group
  4. Wait for the Jupyter kernel to start. A markdown cell should appear at the top of the interactive window
    • (If from Entrypoint 1) The contents of the #%%-cell you executed from the script file should appear as a cell in the interactive window and get executed

Input editor

  1. Use the input editor at the bottom of the interactive window to enter more Python code and use either shift+enter or ctrl+enter to run code against the currently selected Python kernel. You should have syntax highlighting for the code you're writing in the input editor as well
  2. You should have Python IntelliSense for the input editor provided by Pylance, including module completions e.g. import numpy as np --> np. should bring up all numpy module methods
  3. Install a Python snippets extension. Snippets should appear for the input editor as you type User snippets in interactive window input vscode-jupyter#4200
  4. In the input editor if you hit the up arrow you should be able to cycle through REPL execution history
  5. You should be able to customize the interactive.execute keybinding e.g. to bind it to Enter like in the debug REPL Ability to change default "shift-enter" to "enter" when running code in Interactive Window vscode-jupyter#4073
  6. Builtin and VIM keybindings should work in the input editor Python Interactive window does not respect vscode editor keyboard shortcuts vscode-jupyter#1225 Navigation of Interactive Window with VIM keybindings vscode-jupyter#1217

Global toolbar

  • When restarting or interrupting the Jupyter kernel using the interactive toolbar buttons, a new message re: kernel status should be appended to the bottom of the document
  • Clicking the expand and collapse buttons in toolbar should respectively expand and collapse all code cell inputs in the interactive window
  • Clicking the variables icon in toolbar should open the Jupyter variable explorer view (by default this appears in a tab next to the integrated terminal pane). Any variables you defined in your Python code should appear in the variable explorer
  • Clicking the save icon in toolbar should export all cells in the interactive window except the markdown cells containing kernel connection info to a new notebook
  • Clicking the export icon in toolbar should bring up a quickpick with the following export target options: HTML, Python script, PDF. Pick Python script--export should complete successfully and produce a Python script containing #%%-delimited interactive cells. You should be able to reexecute these cells in the current interactive window.

Miscellaneous

  • Changing VS Code theme should also change the themes of the interactive window
  • Changing VS Code font setting should also change the fonts used in the interactive window Change fonts in the interactive window vscode-jupyter#1247
  • After reloading VS Code, interactive window should be restored from backup (kernel connection will not be live)

Other notes

  • Any notebook controllers registered for the 'interactive' viewtype will appear in the kernel picker dropdown; for now only the Jupyter extension contributes such controllers
@joyceerhl joyceerhl added this to the June 2021 milestone Jun 28, 2021
@ghost ghost assigned sandy081, rchiodo and deepak1556 Jun 29, 2021
@deepak1556 deepak1556 removed their assignment Jun 30, 2021
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

4 participants