Uh oh!
There was an error while loading. Please reload this page.
Scraper function for sphinx-gallery, in plotly.io - #1577
Conversation
scraper function + skeleton of sphinx doc with minimal gallery (two examples)
emmanuelle
commented
May 24, 2019
I'm struggling with installing the orca excutable on the CI |
jonmmease
commented
May 27, 2019
Hi @emmanuelle, thanks this is very interesting. A couple of high-level thoughts. Rather than use monkey-patching it would be nice to handle this use-case with a custom renderer (Renderers were introduced in #1474). I'm also a little hesitant to introduce this logic into the plotly.py repo. Would it make sense to add this to sphinx gallery? |
jonmmease
commented
May 27, 2019
So far, I've had all of the orca-dependent tests run in the |
emmanuelle
commented
May 27, 2019
Thanks for the comments @jonmmease ! Yes, a custom renderer would be nicer, I just read through #1474 and it seems well adapted. I initially proposed the scraper function to sphinx-gallery as a PR (sphinx-gallery/sphinx-gallery#493) but their policy is that each plotting library should maintain its own scraper, which kinda makes sense since there is a large number of plotting libraries. So if we want that other projects use plotly in their documentation when using sphinx-gallery (it was mentioned on the scikit-learn mailing-list that there is interest for this), I think we have to include it and maintain it... |
jonmmease
commented
May 27, 2019
Thanks for the background @emmanuelle, having something in the plotly.py repo is fine in that case. Looking over the code, I think we could replace the Would it be possible to get away with only having a custom renderer and not the |
emmanuelle
commented
May 30, 2019
Thanks @jonmmease. The way sphing-gallery handles matplotlib examples is quite different, because it loops through the list of existing matplotlib figures with |
emmanuelle
commented
May 31, 2019
@jonmmease here is a version with a custom renderer. I can add more documentation and comments but first tell me whether this was what you had in mind. I also changed the examples so that now they call |
emmanuelle
commented
May 31, 2019
Oh and the tests failure seem to be due to something else than the tests added by this PR. |
Uh oh!
There was an error while loading. Please reload this page.
| # This module defines an image scraper for sphinx-gallery | ||
| # https://sphinx-gallery.github.io/ | ||
| # which can be used by projects using plotly in their documentation. | ||
| # This module monkey-patches plotly.offline.plot, so we do not |
There was a problem hiding this comment.
We can now remove mention of monkey patching right?
jonmmease
commented
Jun 1, 2019
Thanks for making the renderer update @emmanuelle, this looks nice. I left a couple of comments inline.
Sounds like it would be worth asking, as I'd expect this to be useful for other libraries as well. But it's not a lot of logic, so not a huge deal.
Yeah, this has been fixed on master so if you merge/rebase it should go away. Regarding the example in |
+ changed name of renderer sphinx -> sphinx-gallery, and changed wording of documentation
emmanuelle
commented
Jun 2, 2019
Hurray it's green! I think I addressed all your requests, I moved the sphinx files and gallery examples to plotly/plotly-sphinx-gallery. |
emmanuelle
commented
Jun 4, 2019
@jonmmease no hurry but since you're always very reactive, I just wanted to make sure that this hasn't fallen off your radar :-). |
jonmmease
commented
Jun 4, 2019
haha, thanks for the ping. I haven't forgotten 🙂 I should be able to take a look tomorrow. BTW, are you fine leaving this for v4 or would you like to get it out into the word before that? |
emmanuelle
commented
Jun 4, 2019
v4 is fine, it should be in a month or so right? I'm used to slower development cycles so no pb :-). |
jonmmease
left a comment
There was a problem hiding this comment.
This looks great @emmanuelle, a couple of small comments/requests below but otherwise good to go. Thanks!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
emmanuelle
commented
Jul 2, 2019
@jonmmease sorry to have let this idle for some time. I think the tests failure are not related to this PR. Shall I try to make a new PR to the |
jonmmease
commented
Jul 3, 2019
Looks, good. Thanks! |
jonmmease
commented
Jul 4, 2019
@emmanuelle, could you double check that your sphinx-gallery example works with the |
emmanuelle
commented
Jul 5, 2019
Yes it works! Thank you very much @jonmmease :-) |
* scraper function for sphinx-gallery, in plotly.io. scraper function + skeleton of sphinx doc with minimal gallery (two examples) * added psutil dep to tox.ini * python 2 compatibility * added orca dep to package.json for tests * removed typo * corrected bug * python 2 compatibility * added electron * try to configure orca * Moved test file so that it's tested by the orca build only. * use custom renderer for sphinx-gallery * removed sphinx files which are now in plotly-sphinx-gallery + changed name of renderer sphinx -> sphinx-gallery, and changed wording of documentation * Modified test with new renderer name * try to fix py2 compatibility * write_html instead of offline.plot * change import order
This PR proposes the addition of a scraper function in
plotly.io, to be used by thesphinx-gallerysphinx extension when a sphinx-based doc contains a gallery of examples. At the momentsphinx-galleryhas a scraper for matplotlib figures, but some open-source projects have expressed their interest in having figures with plotly.py instead.The PR also contains a minimal sphinx doc with two gallery examples (one for 2D, one for 3D). It's not necessary to merge this but I thought that having gallery examples in the code base could be useful.
Note that this PR does not require a sphinx-gallery dependency, because it will be sphinx-gallery which calls the scraper function and not the other way around.
One thing to decide is whether the function used in examples is
plotoriplot. Do most users work in notebooks and therefore useiplot? The function is monkey-patched anyway so it's easy to change.