Skip to content
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

Remove "plot_" prefix from examples? #411

Closed
almarklein opened this issue Dec 19, 2022 · 4 comments · Fixed by #422
Closed

Remove "plot_" prefix from examples? #411

almarklein opened this issue Dec 19, 2022 · 4 comments · Fixed by #422
Labels
docs Things related to our docs enhancement New feature or request

Comments

@almarklein
Copy link
Collaborator

The plot prefix is a mechanism from Sphinx-gallery to select examples for inclusion in the gallery. We now also have
# sphinx_gallery_pygfx_render = True, which we can set to False, right? And the prefix can (I assume) be set to an empty string?

cc @FirefoxMetzger

@almarklein almarklein added enhancement New feature or request docs Things related to our docs labels Dec 19, 2022
@FirefoxMetzger
Copy link
Contributor

Unfortunately no, because they do different things.

plot_ (or any other prefix we can choose) tells sphinx-gallery that the file contains plots and that it should eval each code block and pass the output to the scraper.

# sphinx_gallery_pygfx_render = True instructs our scraper to generate an image for the current block that it is provided with. This defaults to False and is evaluated for each block. You can have multiple images in one example and - in this case - you would have multiple # sphinx_gallery_pygfx_render = True comments in the same file (one for each location where a plot should be generated).

If we add # sphinx_gallery_pygfx_render = True in a file without the plot_ prefix then sphinx will never pass the code to our scraper and we won't render anything. Similarly, we need to have some prefix, because we want to ignore examples that are too expensive to render in CI or that target specific backends unavailable in CI.

@almarklein
Copy link
Collaborator Author

So a file starting with plot_ but that has # sphinx_gallery_pygfx_render = True will still be run, as in setting up the viz, but it won't render?

@FirefoxMetzger
Copy link
Contributor

So a file starting with plot_ but that has # sphinx_gallery_pygfx_render = True will still be run, as in setting up the viz, but it won't render?

Do you mean # sphinx_gallery_pygfx_render = False? Yes. A file with a plot_ but no instructions to generate images will be executed in full, but no output will be captured.

@almarklein
Copy link
Collaborator Author

Sorry, yes I meant it to be False. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Things related to our docs enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants