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: saving an Interactive Window #186196

Closed
3 tasks done
amunger opened this issue Jun 26, 2023 · 3 comments
Closed
3 tasks done

Test: saving an Interactive Window #186196

amunger opened this issue Jun 26, 2023 · 3 comments

Comments

@amunger
Copy link
Contributor

amunger commented Jun 26, 2023

Refs: #172974

Complexity: 3

Create Issue


Explanation

This focuses on the behavior for saving an Interactive Window. Current behavior testing should be covered by #186191.

Prerequisites

  • install the pre-release versions of jupyter and python extensions
  • ensure you have a python interpreter installed
  • use Python: create environment to create a local virtual environment in the workspace to keep any changes out of your global python environment
  • You'll need the python kernel packages to run the interpreter as a kernel, but vscode should guide you in installing these when attempting to run anything.

Test steps

  1. Create a python file and add a few code cells (# %% marks a cell), e.g.
# %%
# this will likely show a syntax error in the python file
%pip install matplotlib

# %%
import matplotlib.pyplot as plt
x = [1, 6, 10]
y = [5, 13, 27]
plt.plot(x, y)
plt.plot(y, y)
plt.plot(y, x)

# %%
import time
for i in range(50):
    print(i)
    time.sleep(.1)

# %%
def throwAnError(x):
    raise Exception('This is an error message.')

throwAnError(x)
  1. Execute the code in an interactive window, either Run file in interactive window related commands or the code lenses.
    a. This will open the interactive window editor to be saved
  2. Save the Interactive Window editor. It can only be saved as .ipynb, and the editor will re-open as a notebook.
    a. loading is not supported
  3. Create another interactive window and Switch files.hotExit to off. Then close vscode to ensure you are prompted to save.
    a. test both save and revert options.
@ulugbekna
Copy link
Contributor

Create a python file and add a few code cells (# %% marks a cell), e.g.
Save the Interactive Window editor.

Do you mean that I need to create a new untitled file, put the code with some cell markers, and try saving?

It can only be saved as .ipynb

Does this mean the filename for save should by .ipynb and not .py? Because I get .py

image

the editor will re-open as a notebook.

I save a new untitled file with the code you provided as .ipynb. It does try reopening it in a notebook editor but fails:

Screen.Recording.2023-06-27.at.10.29.39.mov

@ulugbekna ulugbekna removed their assignment Jun 27, 2023
@amunger
Copy link
Contributor Author

amunger commented Jun 27, 2023

@ulugbekna - sorry, I missed a step. you need to execute the code in the .py file with the code lenses or run file in interactive window. It's the interactive window that is intended to be saved.

@ulugbekna
Copy link
Contributor

@amunger thanks for clarification! feature works well for me 👍

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

6 participants