-
Notifications
You must be signed in to change notification settings - Fork 50
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
docs: Auto-generated examples gallery #571
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #571 +/- ##
==========================================
- Coverage 88.20% 87.61% -0.60%
==========================================
Files 39 39
Lines 4528 4528
==========================================
- Hits 3994 3967 -27
- Misses 534 561 +27 ☔ View full report in Codecov by Sentry. |
…into docs-examples
There's a couple of weird things I want to make you aware of:
|
😍🤩 Thank you!! Will have a closer look through your comments soon |
I've had a look (and pushed a couple changes, so pull again before working on it more). I really love it, thanks so much. The only change I'm not thrilled about are the napari examples, and basically anything where the But, I won't think about it too long, this is awesome as is and i want to get it in :) |
Thank you for figuring out the CI and formatting! Two more things I noticed:
|
…ymbols when looking at plain text
That's a reasonable hesitation. I've fiddled with things a bit, and I think things are a bit nicer now. This affects four files:
1 and 2 are because it's hard to run those scripts in the automatic CI. First I tried to see if we could just add markdown files side by side along with the python example files, but it looks like that is not supported. If that's potentially a big long term issue, we could ask if there are any future plans to support that behaviour in mkdocs-gallery. For now, what I've done is to move as much content as possible into the docstrings at the top of the file. Any code we actually want to execute goes below that. That at least cuts down on the number of lines prefaced with You do still have to have at least one Still a small compromise, but perhaps one we can live with for now. I personally think it helps address those concerns a bit. |
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.
let's get this in. I think the end result is great.
there are still a number of things i'm not crazy about, but can address them in follow up PRs. some notes so I remember:
- the gallery plugin appears to be regenerating all of the examples every time any file changes, so using
mkdocs serve
for realtime editing of the docs becomes much less useful. - the gallery plugin appears to be using threading somehow, and sending an interrupt signal with control-C no longer shuts down the
mkdocs serve
live server. this is a big pain... and the only way I've been able to stop it is to kill the entire terminal process. It makes me a bit concerned with the stability/innards of the plugin itself. - I do have general concerns about the mkdocs-gallery plugin itself. in addition to the odd mkodcs serve behavior, it has a mkdocs deprecation warning from something that changed way back in Jun, 2021, so i wonder how actively maintained it is... and it's not a "popular" plugin (by stars) so perhaps has more rough edges.
- i do prefer the current napari examples (with the docs at the top)... but it comes at the cost of code duplication between the code in the docstrings and the code itself, which now has the risk of going out of sync... Perhaps includes/snippets could be used here, but I'll look into that later.
thanks @GenevieveBuckley! |
Currently there are a ton of great examples in the repo that are effectively invisible to anyone looking at the main documentation page at https://pyapp-kit.github.io/magicgui/
This PR uses mkdocs-gallery to automatically generate an examples gallery for the docs website. This provides some nice features, including:
I've previously done something similar for the napari-threedee project napari-threedee/napari-threedee#99. If you'd like to play around with that live on their website, it's here: https://napari-threedee.github.io/generated/gallery/
Here's a screenshot of the proposed new examples page for magicgui, running locally on my laptop. There are a lot of examples, so I've tried to group them into meaningful themes.