Skip to content

Documentation improvements#679

Merged
almarklein merged 22 commits intomainfrom
docs1
Mar 19, 2024
Merged

Documentation improvements#679
almarklein merged 22 commits intomainfrom
docs1

Conversation

@almarklein
Copy link
Copy Markdown
Member

@almarklein almarklein commented Mar 18, 2024

Done

  • Fix that "Examples" heading was shown also when there was no mini-gallery to show.
  • Show mini-gallery at the bottom of the page (instead of between class docstring and its methods/props).
  • Fix that the mini-gallery showed no examples for certain groups of classes.
  • Remove the need for setting target_name by making the canvas-selection a wee bit smarter.
  • Animations behave much better w.r.t. fps.
  • Use webp for screenshots too, because it's much smaller than png, even in lossless mode.
  • Use sphinx_gallery_pygfx_docs comment to control per-file gallery config.
  • Use sphinx_gallery_pygfx_test comment to control per-file test config.
  • Both of these comments must be present in each example. This is tested for.
  • Add advanced docs for how to use our gallery scraper.
  • Updated all examples accordingly (this is mostly what makes this pr so big).

Comment thread examples/HOWTO.md Outdated
Comment thread examples/HOWTO.md Outdated
Comment thread pygfx/utils/gallery_scraper.py
@almarklein
Copy link
Copy Markdown
Member Author

I changed the comment to # sphinx_gallery_pygfx = 'xxx', because that's the standard that sphinx-gallery. Sphinx also "sees" the comment and tries to eval() the value ... but it does not seem to pass that value to the scraper?

I am a bit frustrated because my general feeling during this whole PR is that on the one hand sphinx-gallery is rather opinionated about how it should be used, but on the other hand that API feels incomplete / half-baked. 😕 I just wanted to simplify the way that examples are configured for the gallery, but it got me jumping hoops.


Aaaanyway ... I'm now on the fence about two options:

# Kinda what we have now. The "problem" is that the second comment is shown in the code in the gallery.
# sphinx_gallery_pygfx = 'screenshot'
# example_testing = compare'

import pygfx as gfx
...

vs

# If we re-use/mis-use the gallery option mechanism, sphinx will remove both comments from the gallery code.
# sphinx_gallery_pygfx_docs = 'screenshot'
# sphinx_gallery_pygfx_test = compare'

import pygfx as gfx
...

@Korijn
Copy link
Copy Markdown
Collaborator

Korijn commented Mar 18, 2024

I honestly don't care. Either option is fine if we document it. People will just copy paste whatever we have anyway.

@kushalkolar
Copy link
Copy Markdown
Contributor

People will just copy paste whatever we have anyway.

yup! does anyone actually know how sphinx works fully 😆

@almarklein almarklein marked this pull request as ready for review March 19, 2024 12:10
Copy link
Copy Markdown
Collaborator

@Korijn Korijn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you going to port some of these changes to wgpu-py as well?

@almarklein
Copy link
Copy Markdown
Member Author

We don't have a gallery there, so I guess not? Perhaps if/when wgpu-py gets some more examples ...

@almarklein almarklein merged commit a01ab70 into main Mar 19, 2024
@almarklein almarklein deleted the docs1 branch March 19, 2024 12:23
@Korijn
Copy link
Copy Markdown
Collaborator

Korijn commented Mar 19, 2024

Well, the changes you made to the example testing stuff for example.

@almarklein
Copy link
Copy Markdown
Member Author

Yeah, I can apply that to wgpu too, for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants