-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: Add links to pyodide to examples #11670
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
DOC: Add links to pyodide to examples #11670
Conversation
d5d9ab8
to
9e93a17
Compare
I had a conversation with @lesteve and @choldgraf at scipy about moving this functionality into sphinx-gallery and they werereceptive to moving this upstream. I think we should hold off merging this if there is a chance of the flexibility landing in sphinx-gallery in the near term. |
I'm not too optimistic on what "near term" really means, but sure, if sphinx-gallery provided this functionality by itself it would of course be advantageous. If anything, this PR can also be seen as a kind of requirement statement for what would need to be implemented by sphinx-gallery. |
@ImportanceOfBeingErnest could you explain a bit more about not being able to produce valid Binder links for matplotlib? Binder expects the notebooks to be in the repository, but code could be from anywhere else (e.g. you can put arbitrary shell commands like re: sphinx-gallery, @tacaswell did you open an issue in the repo about what kind of use-case sphinx-gallery would need to meet? I am a bit doubtful they'd be open to pyodide as a first-class citizen, only because that project looks to be in a super-alpha state and seems redundant with Binder functionality. However it might make sense to let people customize their own links at the bottom of examples, provided that they don't add to much complexity to sphinx gallery. |
That was my understanding of what @tacaswell wanted to do. For including that in sphinx-gallery: I would agree that keeping additional complexity as low as possible is key. Adding a test for the feature in sphinx-gallery will be needed too. |
@choldgraf Matplotlib example notebooks are hosted on What sphinx-gallery should support is the ability to add custom rst to the examples (probably at various points in the document). For the case discussed here, it would be enough to be able to provide some function, probably through the I would agree that sphinx-gallery should not (need to) support directly links to any specific service (like webassembly, pyodide in this case); this needs to be in the responsibility of the user. |
@ImportanceOfBeingErnest some thoughts below
Binder does require code to be hosted in a git repo of some sort, though I believe Matplotlib's website code does exist in a GitHub repository, no? Many sites use gh-pages or readthedocs to host their website online. The final page is a "regular" website but it's backed by a regular repository. For example, the sphinx-gallery website is hosted at a repo "sphinx-gallery.github.io". The configuration for the sphinx-gallery binder links is in the sphinx-gallery repo here: https://github.com/sphinx-gallery/sphinx-gallery/blob/master/doc/conf.py#L344 relevant sections:
so a similar pattern should work for devdocs, e.g. something like:
re: the sphinx-gallery stuff, I'd recommend opening up something in the sphinx-gallery repo so the community can discuss. Supporting something like |
So the webpage is hosted on https://github.com/matplotlib/matplotlib.github.com. I hence used this configuration
This will produce a link like which is not valid. I found that the following link actually lets the notebook start however, once the notebook appears, it says that the kernel cannot be started or has died. There also seems to be no way to generate this link through the |
A couple quick thoughts:
(if you share a URL to your fork where you're doing this work, I can try to get the config working. I'll open up a PR in sphinx-gallery to clarify some of the points you bring up as well, thanks for taking the time to mention where the confusion is) |
I see. So there is just a big conceptional gap between how things are done in matplotlib and how binder assumes things to be. Matplotlib docs are not genereated within the Leaving this as it is, because it will still work for adding links to pyodide - in case that is desired. |
9e93a17
to
1af2d48
Compare
1af2d48
to
97d1ea7
Compare
The documentation build and deploy process is documented at https://matplotlib.org/devel/release_guide.html#build-and-deploy-documentation https://github.com/matplotlib/matplotlib.github.com is what hosts the live documentation, I would prefer we not debug this process against that. From a serving point of view not sure what would have to be done to get github to serve from a fork of Given the two-layer deployment of the docs (into the top level and into the version specific folders) would it make sense to push the notebooks to a new repo (maybe in a new org matplotlib-binder with matplotlib-vX.X.X repos) that will be a stable public API over time? |
Not sure if it makes sense to host the notebook at yet another place. I mean all notebooks are there, namely on |
I'll close this as it was just a POC... |
PR Summary
This is a proof of principle on how to potentially add links to pyodide to the examples in the gallery.
Link to built documentation - choose any example to try out.
This was proposed by @mdboom and discussed on gitter. It is also similar to the idea of adding 'binder' links, as in #11415.
Now the problem is that shinx-gallery, which generates the examples and links is hardly customizable. One option, which is pursued here, is to monkey patch the sphinx-gallery function that would usually generate a 'binder' link to actually produce a link to pyodide.
One could also link to 'binder', however, it seems that the configuration for 'binder' assumes that the notebook files to be run are actually present on the same github repo that hosts the code - which is not the case for matplotlib. I have hence not found a way to produce valid binder links (attn. @choldgraf)
Note that adding such links may have potential drawbacks, some of which are discussed in #11415, which may include:
In general this is more a code-enhanced discussion kick-off, but may of course be improved and/or merged if people think this to be valuable.
PR Checklist