nbtutor
nbtutor copied to clipboard
Running nbtutor with kernels other than a Python kernel
I notice that the original Python Tutor application can be used with with "Python, Java, JavaScript, TypeScript, Ruby, C, and C++" programmes, though I'm not sure how it actually works...
Which got me wondering - will this plugin be able to work with other kernels? If so, to what extent might the approach generalise to other language kernels too, such as R?
At the moment no, it will not be able to work with other kernels. To be honest this is not something I have looked into yet, but it is something I would like to incorporate at some point.
The way this extension works at the moment is: On the kernels side:
- Trace through the cells code line-by-line
- Generate a json object (metadata) of stack frame data
- Send that metadata to the front end
On the front end side:
- Once new metadata is received from the kernel, find the correspond cell
- Create the html elements representing the names and objects
- Moving from line to line in the code is just the stepping though of this metadata and the re-creating of the html elements
I will have to get back to you regarding what exactly is need to support R. Off the top of my head:
- As far as I am aware the
Rkernel does not have cell magics, so code would need to be sent to a function that implements 1 to 3. - 3 is currently done using comms, which I do not know if the
Rkernel has an equivalent for or not. - For the front end the notable changes would be the need to document and standardize the metadata it receives and of course different visualizations for the different languages. I have never used
Rbefore so I don't know how its memory model looks.
I just stumbled on nbtutor through an e-mail an jupyter-education. That sounds great for teaching!
My main class is introduction to programming in C++, using xeus-cling, so I'd be very much interested in support for this kernel. To be more specific about the scope, we use and would like to graphically debug programs involving:
- basic types, vectors, strings
- control structures, functions
@SylvainCorlay: any insight of what it would take to split this extension into a kernel agnostic part and primitives to be implemented in the each kernel? @gouarin: you may be interested too
Cheers,
Hi there, @nthiery I have the same need as you, but for C using jupyter-c-kernel (or maybe xeus-cling too)
From what I understand, this project was not using the PythonTutor website, am I right @lgpage ? So there is no easy way to extend this jupyter nbtutor extension to non-Python kernel.
A possibility could be to see what was discussed https://github.com/kikocorreoso/tutormagic/issues/8 and use a recent open-source fork version of PythonTutor, such as @seamile/PyTutor @seamile if you're interested in joing the discussion?
Cheers.
Ok, I just tried by switching offline/online, or being online and disabling just pythontutor.com from my DNS, and it stops working as soon as the pythontutor.com website is unavailable. So I was wrong when claiming
From what I understand, this project was not using the PythonTutor website, am I right @lgpage ? So there is no easy way to extend this jupyter nbtutor extension to non-Python kernel.
- Bad news, it can't be used offline!
- Good news, it means that extending it to use all the other modes of PythonTutor.com should not be too hard!
@lgpage if you are interested in trying this, see https://github.com/kikocorreoso/tutormagic/issues/10 et https://github.com/kikocorreoso/tutormagic/pull/11 for the similar project tutormagic (just one hour ago);
Cheers!
Just FYI, currently PythonTutor.com accepts the following mode: python2, python3, py3anaconda, java, javascript, typescript, ruby, c, c++