Skip to content
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

Running nbtutor with kernels other than a Python kernel #31

Open
psychemedia opened this issue Jan 27, 2017 · 5 comments
Open

Running nbtutor with kernels other than a Python kernel #31

psychemedia opened this issue Jan 27, 2017 · 5 comments

Comments

@psychemedia
Copy link

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?

@lgpage
Copy link
Owner

lgpage commented Jan 27, 2017

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:

  1. Trace through the cells code line-by-line
  2. Generate a json object (metadata) of stack frame data
  3. 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 R kernel 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 R kernel 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 R before so I don't know how its memory model looks.

@nthiery
Copy link

nthiery commented Sep 12, 2017

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,

@Naereen
Copy link

Naereen commented Feb 20, 2021

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 kikocorreoso/tutormagic#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.

@Naereen
Copy link

Naereen commented Feb 21, 2021

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 kikocorreoso/tutormagic#10 et kikocorreoso/tutormagic#11 for the similar project tutormagic (just one hour ago);

Cheers!

@Naereen
Copy link

Naereen commented Feb 21, 2021

Just FYI, currently PythonTutor.com accepts the following mode:
python2, python3, py3anaconda, java, javascript, typescript, ruby, c, c++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants