-
Notifications
You must be signed in to change notification settings - Fork 459
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
Add interactive plots in documentation #4938
Conversation
Really appreciate your work here @ChristosT. Ping me if you need me to focus on this for a spell. I'm quite busy with a few other projects, but I can spare some dev time over the weekend if needed. |
a371e75
to
c020dbb
Compare
Query the plotter and use gif files if they are requested. Use interactive (i.e.) vtksz files only if a scene exists in the plotter fallback to static png if it does not.
Give the option to force a static image even if an interactive scene exists. This allows to skip cases where the interactive scene is buggy or not as expected.
…tory. The gallery extension generates the vtksz files under the source while the rest of the documentation under build. The ViewerDirective path replacements are able to handle both now.
The sphinx gallery will look for the boolean variable `PYVISTA_GALLERY_FORCE_STATIC_IN_DOCUMENT` in the parsed code to figure out if static images should be generated instead of an interactive vtksz file. Generation of static images can be also controlled at a block-level defining "PYVISTA_GALLERY_FORCE_STATIC = True" or "PYVISTA_GALLERY_FORCE_STATIC = False" within the block.
It does not work well with interactive scenes and since flying edges is all about creating a mesh it makes sense to sacrifice specular int his case.
48cf2bf
to
aab22cf
Compare
@akaszynski @tkoyama010 @banesullivan I would appreciate a review or any comments in general :-) . I still need to figure out the failing |
I have no problem. The documentation has been corrected in past patch releases like typo fixes, and this can be viewed as one of them. It could be taken as a new feature, but since it is a Sphinx extension, it is not a change to PyVista API. In any case, let me know when you are ready to release. I will do the next patch release once this PR and #5321 are merged. |
Co-authored-by: Bane Sullivan <banesullivan@gmail.com>
Follows the current convention where: - requirements_docs.txt: pin everything because our documentation build tends to be fragile and is only fully executed around releases - requirements_test.txt: limit dependencies by minor release and let dependabot bump these which we can easily pick up on errors, deprecation warnings, or breakages - requirements.txt: same as requirements_test.txt but this is just the core dependencies Co-authored-by: Bane Sullivan <banesullivan@gmail.com>
github-actions preview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Giving this my rubber stamp though I'd like to peruse the generated documentation one last time
@ChristosT, going to let you handle that merge conflict |
Thank you for the help and guidance this was a long but fun ride ! As discussed in the past I will create issues for the pending items once the documentation is updated online so that I can point to the faulty items. |
Thanks for the hard work on this @ChristosT! We're actually having issue deploying this to GitHub pages and will have to change our hosting platform before these changes will be visible |
Thanks ! Just for reference, for demo link I used above I deployed manually on netlify through their cli tool. Not sure if this approach is applicable here though . |
Yeah, it looks like netlify might be the best, immediate solution. I'm looking into seeing if I can migrate everything there |
Overview
An attempt to bring back the interactive plots in the documentation of pyvista .
This pull request replaces current "pyvista" scraper with the Dynamic scraper in order to allow for interactive examples in the pyvista documentation.
resolves #4877
Live demo
Details
The
pyvista-plot
directive will now produce interactive scenes by default.For cases where this does not work well or a static image is preferred a new option
force_static
is introduced. See example hereThe gallery extension is also updated so that documentation generated from examples contains also interactive scenes.
For this case we provide a fallback option per document (
.py
file): just definePYVISTA_GALLERY_FORCE_STATIC_IN_DOCUMENT = True
as a global variable in the script.More fine-grained control can be given by
PYVISTA_GALLERY_FORCE_STATIC = True/False
which can be defined in block scope example.In both cases the variable can be hidden from the generated documentation via
sphinx_gallery_start_ignore
/sphinx_gallery_start_ignore
guards.I went through all the examples and rest of the documentation and turned back to static where the result was sgnificantly different from the current static version. (I may have missed something of course).
Future work:
Note that as before to test this locally you need to run a http server
python -m http.server
in the html directory.