DonJayamanne / vscodeJupyter

Jupyter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter
MIT License
335 stars 34 forks source link

feature request: ui for inspecting the value of variables? #70

Open breathe opened 7 years ago

breathe commented 7 years ago

It would be nice if vscodeJupyter provided functionality that made it as easy as possible to inspect the value of variables while connected to a running kernel ... Maybe something along the lines of a magic comment character (similar to quoakka.js (https://quokkajs.com/docs/) -- or matlab's variable workspace ...?

ghost commented 7 years ago

Something like in RStudio or Spyder (a tab with variable list, df view etc) would probably be the best. Think it was suggested couple of times in long enhancement ideas ticket.

ivanarnold commented 7 years ago

Also would like to see something like this, though my suggestion would be (maybe) even simpler. I would like to something like a command launcher that output to the running notebook. Yes, I know that I can type a line and execute that line, but I think it would be more efficient if I could use a hotkey, type some python, and then have that code executed in the running kernel and any output sent to the notebook.

Example: If I wanted to explore current variables I could type [hotkey] %whos [enter] and the notebook would display

Variable     Type        Data/Info
----------------------------------
adf04_dat    Struct      <read_adf04.read_adf04.<l<...>object at 0x7f78fc198cc0>
adord        ndarray     13x2: 26 elems, type `int64`, 208 bytes
np           module      <module 'numpy' from '/us<...>kages/numpy/__init__.py'>
os           module      <module 'os' from '/usr/lib/python3.6/os.py'>
read_adf04   function    <function read_adf04 at 0x7f78fc200b70>

This is the same thing I get by running the line %whos . I just would like to be able to run it one time without it cluttering up my script.

Just my two cents. Thanks for the awesome work!!!

Edit

An alternative is as simple as opening up a terminal in vscode and typing jupyter console --existing . It will spawn a jupyter console connected to the running kernel that can be used interactively. If there is more than one kernel running you will need to specify which kernel to use.

Executing %whos will list current variables. You can inspect a single variable by executing [variable]? .

tomitrescak commented 6 years ago

Hi, I would like to attempt to create a variable viewer, but I'm having problems running your extension from code. It seems that your frontend is not building or moving to the correct place when debugging the app. Any advice how can I do run his extension in debug envirnment?

Here is the error:

Error: Failed to lookup view "/Users/tomi/Github/forks/vscodeJupyter/out/browser/index.ejs" in views directory "/views"
    at Function.render (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/application.js:580:17)
    at ServerResponse.render (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/response.js:1008:7)
    at Server.rootRequestHandler (/Users/tomi/Github/forks/vscodeJupyter/out/src/display/server.js:72:13)
    at events_1.EventEmitter.start.app.get (/Users/tomi/Github/forks/vscodeJupyter/out/src/display/server.js:49:18)
    at Layer.handle [as handle_request] (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/router/layer.js:95:5)
    at /Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/tomi/Github/forks/vscodeJupyter/node_modules/express/lib/router/index.js:275:10)
    at cors (/Users/tomi/Github/forks/vscodeJupyter/node_modules/cors/lib/index.js:188:7)
    at /Users/tomi/Github/forks/vscodeJupyter/node_modules/cors/lib/index.js:224:17
    at originCallback (/Users/tomi/Github/forks/vscodeJupyter/node_modules/cors/lib/index.js:214:15)
    at /Users/tomi/Github/forks/vscodeJupyter/node_modules/cors/lib/index.js:219:13
    at optionsCallback (/Users/tomi/Github/forks/vscodeJupyter/node_modules/cors/lib/index.js:199:9)

Nevermind: Got it. "compileReact" does the trick.

tomitrescak commented 6 years ago

Hi, I just did a PR #102 adding a variable view to the output window. Hope you'll find it useful.

pythonvariables

tomitrescak commented 6 years ago

CC @johndpope could be helpful from microsoft/vscode#29971

flaport commented 6 years ago

@tomitrescak , I am excited to try your variable explorer already. However, I am getting the same error as you initially got when I try to debug the extension. Could you explain in more detail how this "compileReact" trick works? (I am a complete beginner in terms of typescript)

johndpope commented 6 years ago

awesome! - @tomitrescak