-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Binder jupytext #12116
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
Binder jupytext #12116
Conversation
There is rather long discussion about making examples available for interactive use in In contrast, the approach here would be to let binder generate notebooks from the example Here is the link to an introduction of jupytext. And this is the jupytext github repo. Still, a little bit of explanation about how that plays together with binder would probably be welcome. Attn. @choldgraf who initiated some of the earlier attempts for binder links via sphinx-gallery. |
Comparing the notebooks generated via sphinx-gallery, which are downloadable below each example, and the ones generated via Jupytext is that Jupytext apperently triggers a new cell at each comment or double line break in the code, such that figures are not shown upon |
Thanks! That's very helpful. I will also read the related discussions, they seem pretty interesting! Jupytext is a plugin for Jupyter notebook that allows Jupyter to read/write notebooks directly from/to plain Python scripts. No ipynb file is generated in that process. Binder provides the Jupyter notebook, and the two seem to work well together. Jupytext currently splits python files, when it reads them as a notebook, on blank lines (well, blank lines not inside functions, classes, etc). Clearly the current implementation does not seem to work well with the example above. Can you think of another approach (two blank lines??) that would work better (is there something like an implicit cell separator in the matplotlib examples)? |
I think the same separators as rst are 95% of the time the appropriate ones (i..e a long line of |
The approach I took for sphinx-exhibit (#11936) is to use toplevel strings as text cells (with the option to use sphinx-gallery's choice). I actually think this works well with the single-cell case (just a docstring):
(ok it looks horrible without syntax highlighting and with a stupid example but I think you get the idea) Here if you just want to separate two code blocks you could just put in a toplevel empty string ("" or """""") which is less a pain to type than 79x#... Also, I guess(?) this will again choke on more complex rst constructs (cf the image tutorial example in the sphinx-exhibit thread) because I think they are basically unparseable without running them through sphinx. Now you may say oh well let's just switch everything to markdown but it's never going to be as expressive... |
Thanks for the feedback! I'm new to RST, Sphynx, etc, but happy to learn. Let me come back in a few weeks with a proposal for another format in Jupytext that will better treat Sphynx oriented scripts (mwouts/jupytext#80)... |
@mwouts check out sphinx-gallery for one way to do the python -> notebook conversion. I'd be (in theory) +1 on factoring out sphinx-gallery's conversion code into a standalone |
@choldgraf , thanks for the reference. I have started exploring the sphinx-gallery module, and I am doubting how to exactly implement the sphinx-gallery format for Jupytext (mwouts/jupytext#80). Do you want to advice on whether I should include the RST to markdown conversion? I am asking as Jupytext offers, for the other formats, a solid round trip conversion (that allows to safely edit scripts from within Jupyter). Converting RST to markdown would break that - is it worth the nicer rendering? |
Hello everyone. I have just published a new RC for Jupytext, which now has support for Sphinx-gallery scripts. Would you like to have a look at the matplotlib binder ? Documentation for that rc is here. Thanks! |
very cool! thanks! |
Closing for now. The binder links here give a TOC< but the actual examples don't seem to render, so I'll assume this is not working yet? But happy to re-open... |
Ooops, my apologies - binder must have been having a hiccup. It seems to work now. |
I'll close this as not getting enough traction, but anyone should feel free to re-open (or request) |
The binder project and Jupytext can turn the matplotlib example library into a collection of interactive notebooks.
Try it now at https://mybinder.org/v2/gh/mwouts/matplotlib/master?filepath=examples
Further work is apparently required on the examples themselves - not all plots are shown correctly in Jupyter (Is that a Jupyter configuration issue? Your probably know better than me).