-
Notifications
You must be signed in to change notification settings - Fork 103
Adds support for all Jupyter kernels to PythonTeX #149
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
base: master
Are you sure you want to change the base?
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.
|
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? |
|
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. |
|
Has there been any progress on this on the LaTeX side? |
|
I didn't realize so much time had elapsed with nothing being done on this. Any word? Any way I can help? |
|
@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 |
|
@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. |
|
@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.
|
|
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: