yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.38k stars 873 forks source link

Can knitr interface to Jupyter's machinery to run Jupyter kernels? #1694

Open DrAndiLowe opened 5 years ago

DrAndiLowe commented 5 years ago

Hi Yihui,

I'm a huge fan of knitr and much prefer it to Jupyter notebooks. However, there are many more language engines available for Jupyter than are currently available for knitr.

This might be a dumb question, but here goes: rather than adding new engines one-by-one, is there some way of interfacing to the Jupyter machinery so that it would be possible to run any kernel that can be run in a Jupyter notebook? It sounds like a reasonable way to solve issues like #1452 and other "add engine X" issues.

Thanks!

yihui commented 5 years ago

Sorry, but I don't know the answer. I know little about Jupyter's kernels.

DrAndiLowe commented 5 years ago

OK, no problem. Just an idea. I'll ask around to see if my friends in the python community know of a way. Thanks for reviewing this issue.

DrAndiLowe commented 5 years ago

I asked a friend who pointed me to this console/terminal program for running a Jupyter notebook, which might offer hints on how to capture input and send back the results, in a similar way to how I understand some of the language engines supported by knitr work. I assume that internal state would not be preserved between code chunks. I'm not so familiar with Python as I am with R, so it's going to take me some time before I can figure out if I can make use of any of this to construct a "universal adapter" that would enable users to plug any Jupyter kernel into knitr and have it execute code and see the results in their document. Nevertheless, I'll leave the link here in case anyone more knowledgeable in Python can pick up the ball and run with it.

cderv commented 3 years ago

This FR is related to the topic of adding more engine among them https://github.com/yihui/knitr/pull/1829 and maybe with #1619 on the topic of Jupyter.

Creating this links for future references.