Skip to content

Test: built-in Notebook Variables view #203058

@amunger

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions