Skip to content

Test: built-in Notebook Variables view #203058

Closed

Description

@amunger

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

Activity

  1. added this to the milestone on Jan 22, 2024
  2. roblourens commented on Jan 23, 2024

    @roblourens
    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?

  3. removed their assignment
    on Jan 23, 2024
  4. amunger commented on Jan 23, 2024

    @amunger
    CollaboratorAuthor

    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.

  5. locked and limited conversation to collaborators on Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions