Adds support for all Jupyter kernels to PythonTeX - #149
Conversation
I'm pretty excited about this! Hope you find it useful. A few notes: 1. Should silently do nothing if you don't have Jupyter installed. 2. If you have Jupyter installed, then when you run PythonTeX, you'll see it print the list of Jupyter kernels installed, and how it chose to name them. 3. I'm sure there are many features and tweaks that will be needed, but it does actually work in this rudimentary form.
gpoore
commented
Jun 5, 2019
This is a great way to add Jupyter support while working around the limitations of the current code execution system! I may have a couple minor improvements for interfacing with PythonTeX. My only substantive comment is about using Jupyter kernels. Something like We can discuss additional refinements and features later, but just so I can be thinking about future directions, do you eventually want automatic inclusion of rich output like LaTeX representations of output or images? |
nathancarter
commented
Jun 5, 2019
Right now (see this line) I just drop all offending characters from a kernel name. This will, unfortunately, make python2 and python3 into "jupyterpython" which is a collision. I love your idea of supporting them by recognizing Eventually, I'd love to support lots of kinds of rich output from Jupyter, but I just wanted to see if I could get a simple proof of concept working at first. If this passes your tests smoothly, then we can talk about adding things like image support and so forth afterwards. |
asinghvi17
commented
Aug 9, 2019
Has there been any progress on this on the LaTeX side? |
nathancarter
commented
Sep 3, 2021
I didn't realize so much time had elapsed with nothing being done on this. Any word? Any way I can help? |
gpoore
commented
Sep 14, 2021
@nathancarter Sorry for the lack of progress on this. What you've provided on the Python side looks like it would provide basic functionality for stdout and stderr. I think the main thing remaining there is image support for rich output. I have some experience with that from Codebraid and don't see that as particularly difficult, at least for basic cases. The real issue is the LaTeX side. My time for open-source software has been somewhat limited for an extended time, most recently largely due to the pandemic. I find LaTeX programming something like 10-1000x less productive than languages like Python, so when my time is limited it's difficult to justify spending it on LaTeX. Getting Jupyter kernels working sooner rather than later will probably mean that someone besides me will have to implement the LaTeX side. That might not be too difficult to just get stdout and stderr working, but getting support for rich output (images) will need a new set of features that provides a |
nathancarter
commented
Sep 14, 2021
@gpoore Thanks for the update! Let's make the important distinction between the three very different benefits there are to having Jupyter supported in PythonTeX.
The reason it's important to split these out is because 1+2 require almost no work at all and no LaTeX programming and can be done right away and bring those benefits now, while item 3 is the one that requires tons of work, including LaTeX programming. (I totally sympathize, by the way--I hope to never write a real program in LaTeX ever.) The takeaway: I wouldn't want the existence of item 3 as a possible later upgrade to block the immediate potential benefits of items 1+2. Item 3 should be classified as a possible later upgrade, not a blocker for items 1+2. |
gpoore
commented
Sep 15, 2021
@nathancarter Those distinctions are helpful. For the things I do, rich output is really the only reason to ever use a Jupyter kernel outside of a Jupyter notebook. To support Jupyter kernels only with stdout and stderr output, here's (at least most of) what's needed.
|
dimpase
commented
Dec 14, 2023
In case, sphinx has extensions which use Jupyter (kernels) to typeset Python docs. So that's not something very unique here. |
I'm pretty excited about this! Hope you find it useful. A few notes: