-
Notifications
You must be signed in to change notification settings - Fork 9
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
Interactive pyvista scenes in examples #826
Interactive pyvista scenes in examples #826
Conversation
Thanks for the work @ChristosT 😄 We really appreciate having the option to have interactive plotters. However we have some concerns with the maintainability of this approach:
Overall I think this is in the right direction, we just need more maintainability in the solution for it to be stable in the long term. Let me know what do you think about these points and feel free to reach me if you have any doubt. Thanks again for the hard work you are doing 🚀 |
Thank you for the quick review ! regarding the first of your points I totally agree about the extra burden I will be looking into it. Ideally we could move the extra code to the return value of As for the other two. The |
That's perfect, I'm glad that dependency versions are not a problem. A suggestion, if you plan to integrate the code into the |
working with pyvista to integrate this into |
Great! Thanks for working on this 🙂 |
I believe you can get rid of all the "bad" Vale warnings (meaning they shouldn't even be occurring), by updating the Documentation Style Check in the ci_cd.yml file to note a Vale version: docs-style: @Revathyvenugopal162 for confirmation! |
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.
Hi, @ChristosT I don't have the technical knowledge to review this PR. I'll leave that to Alex and Roberto!
Hi @PipKat - yes we are aware of these Vale issues. We are pending their resolution. Vale checks have been deactivated on the main branch. I am curious why they have kicked in here. |
Oh now I see - the fork is outdated. |
Looks related to the trimmed version of the documentation we are using relevant warning: pyansys-geometry/doc/source/api/ansys/geometry/core/designer/face/index.rst:471:duplicate object description of face.edges, other instance in api/ansys/geometry/core/designer/face/index,
The current makes the code-block and the rendered scene too narrow
1231f64
to
7515364
Compare
for more information, see https://pre-commit.ci
@AlejandroFernandezLuces this now works with the latest master of pyvista. The new pyvista release is coming soon. |
I'll give this a try and I'll let you know my feedback, thank you for implementing this 🙂 |
I added your changes to my local, unfortunately we are still facing issues. When rendering with HTML backend, we get the interactive scene in the docs, but it is always empty. In this screenshot, I ran the same code in a python terminal and in a Jupyter Notebook with HTML backend. I'll triple check to see if I'm missing anything, but it seems to me that this is caused from PyVista side. Any ideas of what might be happening? |
Does it work if you have a single object ? |
Any news here @AlejandroFernandezLuces ? |
The problem seems to happen with MultiBlock objects only. If I add a PolyData object it seems to work fine. However, if I add only one MultiBlock it doesn't show anything. Using the Python viewer everything works as expected, so I think this is on PyVista side. If you have any idea or need me to test anything let me know 🙂 |
The changes in pyvista/pyvista#4938 may not be easily applicable to the
examples
section of thepyansys-geometry
documentation:pyvista
usessphinx-gallery
along with a custom scraper for reading the source of an example from a.py
file and generating a.rst
files that embeds a customofflineviewer
directive.We could convert all examples from jupyter notebooks to
.py
files and usepyvista
infrastructure to generate the examples gallery .As an alternative we can add a simple snippet after every
plot.show()
that extracts the scene ashtml
and embeds it in the documentation as aniframe
i.e.of course we do not want to show all this code to the user so, we can use cell tags to hide it . See the modified
.mystnb
file.However, these tags come with a couple of requirements.
Switching to the myst_nb parser from
jupytext
that is currently being used. I am not sure why.jupytext
should support these tags but in my experiments it does not. Maybe I am missing some configuration.The version of
myst_nb
from pypi is incompatible with the dependencies of this project (limitssphinx
version among others) so we need to install the latest from git. (A new release should come soon see here )With the above caveats here is one example:
pyansys_geometry_documentation_00-2023-10-24_20.09.12.mp4
(remember to start a html server if you try this pull request locally
python -m http.server --directory doc/_build/html
)@AlejandroFernandezLuces