-
Notifications
You must be signed in to change notification settings - Fork 334
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
Live Variable Watches #25
Comments
This would be awesome. My dream development environment actually looks a lot like the Chrome Dev Tools mid-debugging, with watch expressions, lists of the values of all variables in scope, and value-on-hover for variables in your code. Watch expressions are a great first step towards that. I'd like to implement them in a language-agnostic way. What about a panel on the side of the editor that, after every chunk of code you send to the kernel, reruns all its watch expressions and shows the results? So the flow would be:
It's not quite as good as having all the old values there too, but it could be implemented with no knowledge of the particular language and no parsing of the code, and with little overhead. Then the interface would look something like this (potato quality) drawing. Or maybe a smaller panel that doesn't take up a whole vertical column. Or something. We can figure that part out. |
This sounds eerily like it could use the comms channel that the ipython widgets use. |
Huh, I hadn't looked at that channel at all. Can we use it with updates to Hydrogen alone, or does it need kernels to play along? |
This could also be used to debug functions/methods directly by placing a call with parameters on the panel where the result of every assignment is displayed below (maybe even the same line, just like Bret Victor has envisioned it). I don't know if the panel is the best way to display plots or anything that is bigger than some small values. Any ideas? |
Definitely useful for functions, plots, etc also. I would love having live plots of my data onscreen while I manipulate it. I expect a few hundred pixels wide is enough to use the plots to keep tabs on what's going on. You probably wouldn't want a larger plot always on-screen. When it's the thing you're actively looking at, you can run it in the main editor (or maybe resize the pane bigger). This is now a priority, and probably the next significant feature that I work on. |
Sounds great, maybe this will cause some further ideas for interactive programming. I'd love to see that! |
This is now available for testing on the You can install this branch by running Anybody who tries this out, let me know what you think in a comment on the pull request! |
you might want to have a look at user_expression, they are side execution request that can be inserted by the client that are excuted befor (or after?) user code, do not appear in history and are ment to convey side information to the frontend. You can for example, ask for a list of variable to be sent back after each execution, as a json objet. |
@Carreau that's a really good thought. For the moment I'm going to stick with this implementation despite it being a little dodgier and semantically incorrect. One of my biggest priorities is maintaining compatibility with as many kernels as possible, and lots of them implement only the "critical path" of executing code and skip the bells and whistles that are in the spec but not required to make the Jupyter notebook work. Definitely a change to make down the line though. |
I completely understand, and that's typically the kind of things that are underdocumented. This is one of the reason we asked for some funding to ba able get the principal kernel and frontends authors in the same room for a couple of day and figure out theses things. |
That would be great. I also cannot recommend strongly enough having some certification or automatic suite of tests for kernels. 75% of the kernels I've seen (from e.g. https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages) are broken, incomplete, or not to spec in one respect or another, and many of them don't even work with the notebook frontend. Having a certification or testing process which displays a warning to the user when they're on a dodgy kernel would encourage kernel devs to implement the spec more closely (and tell them where they're not). Right now it seems like "works with the notebook" is the de facto test suite, and all kinds of awful things get shipped as a result. |
We are working on that : https://github.com/jupyter/jupyter_kernel_test Still a question fo documentation on how to run it. |
Frankly I think it will just take a lot of per-language effort to get this off the ground, but it's extremely worth it. I expect many kernel developers will need an extra push to run these tests and implement parts of the spec they aren't personally using. Something like a build status badge on the kernel's logo in the notebook (that all their users can see) might do the trick. |
There is work on that too, a main page that list the kernels and their features. Having auto-testing kernels features to put badges was considered. |
Design issues aside, this would be a strong step. Especially if there was a really clear separation between "known good" kernels and "experimental" ones. |
Shipped! |
It would be nice to have the functionality to place variable watches directly in the code, just like it's possible in LightTable.
Most likely, this will require modifying the code that is sent to the kernel by adding a language specific call such as:
where the inline display is added before sending the code to the kernel. This is already possible manually. However instead of listing only the actual value of the variable, every single change is concatenated into a list.
This feature would also make it possible to change plots online as every change would be displayed automatically.
The text was updated successfully, but these errors were encountered: