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 Notebook Variables view #203058

Closed
3 tasks done
amunger opened this issue Jan 22, 2024 · 2 comments
Closed
3 tasks done

Test: built-in Notebook Variables view #203058

amunger opened this issue Jan 22, 2024 · 2 comments

Comments

@amunger
Copy link
Contributor

amunger commented Jan 22, 2024

refs: #165445
microsoft/vscode-jupyter#14821

Complexity: 4

Create Issue


Pre-requisites - If you don't have python set up to run notebooks

  1. ensure python is installed on your machine
  2. install the latest pre-release Python and Jupyter extensions
  3. open a workspace where you will be running tests for this TPI
  4. Create: new jupyter notebook and run print(1) in a cell.
    a. If the cell runs successfully, you're already set up, otherwise...
  5. The kernel picker should open, select "Python Environments..." -> "Create Python Environment..." -> select venv or conda, and whichever version you'd like.

A virtual environment should get created in your workspace with all necessary packages installed, and the cell should run successfully.

Testing

The jupyter extension is the only extension with a variable provider at this point, and only for python

  1. set "notebook.experimental.variablesView": true, in settings
  2. Create a notebook and run python cells that assign variables (sample code below)
  3. Open the debug view and find the new Notebook Variables section
  4. explore the variables

Known issues / shortcomings

Improve large collection handling: #203060
More detail in value for collections: microsoft/vscode-jupyter#15056
Keep expanded state persistent: #203067
Don't show the notebook variable view when not applicable: #203068

sample code

simple types

aString = "Hello"
aList = [1, 3, aString]
listOfLists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
aTuple = (3, 4, aString)
aSet = {5, 6, aTuple, aString}
aDict = {"key1": 8, "key2": aSet}
anInt = 11
aFloat = 11.3
boolean = False

objects

class A:
    prop1 = 1
    prop2 = 2

    def __init__(self, a, b):
        self.a = a
        self.b = b
        self.list = [1, 2, 3]

class B:
    propList = [A(100, 200), A(300, 400)]

anObject = A(12, 15)
nestedObject = B()

long list

aLongList = []
for i in range(100000):
    aLongList.append('listEntry' + str(i))

circular reference

dict1 = {'key1': 1}
dict2 = {'key2': 2, 'otherDict': dict1}
dict1['otherDict'] = dict2
@roblourens
Copy link
Member

I got caught by not being able to expand nodes while paused in the debugger. At one point I was thinking that while paused, we might use the debugger to update values. Is that not actually possible, or would you try that at some point?

@amunger
Copy link
Contributor Author

amunger commented Jan 23, 2024

I got caught by not being able to expand nodes while paused in the debugger. At one point I was thinking that while paused, we might use the debugger to update values. Is that not actually possible, or would you try that at some point?

We could do that, the extension's view does by delegating to either a debug provider or kernel provider. I was just thinking that the debug variables view already contains all that info, but it is a strange behavior.

@anthonykim1 anthonykim1 removed their assignment Jan 24, 2024
@aeschli aeschli removed their assignment Jan 24, 2024
@aiday-mar aiday-mar added this to the February 2024 milestone Feb 6, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 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

6 participants