-
Notifications
You must be signed in to change notification settings - Fork 197
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
Ease running on just one file #1282
Comments
+1 for doc updates talking about how to configure sphinx to only build a few files (and ignore warnings). In some sense this is outside the scope of sphinx-gallery as it's a more general Sphinx concept but it'll probably help people.
FWIW typically for "update a single example" I think the workflow people typically use is:
Then you don't have to worry about ignores etc. because just about everything else should work. So -1 on SG trying to be smarter about detecting changes -- I think we already do the standard thing and only rebuild files that have been modified. If you don't modify anything then running Sphinx twice (for a correctly configured project) the second run should be a no-op (end in just a few seconds). |
I think I'm following the workflow you described but my doc rebuilds normally take pretty long (I just timed 10 min for a from-scratch build for all project docs, and 3 min for a rebuild). I'm not doing anything fancy, just "make html". Not that I profiled it but most of the build time seems to not be spent on the galleries. Builds take a few minutes even when I haven't modified a file. Maybe there's a problem with how Matplotlib has doc builds configured with sphinx but it seems that others more experienced than me have long doc rebuild times on Matplotlib. If the Matplotlib docs should only take a few seconds to rebuild, that's out of scope for sphinx-gallery. I think that the following point is in scope for sphinx-gallery. I have now observed that Because the part of the sphinx-gallery docs that I cited addresses how to use -D to pass an option for a single build, not how to build a single file, I think it's best to use a different example for -D and to add a section on how to build a single gallery. Thanks for helping me figure this out! |
Yeah in theory running sphinx-build twice should be very quick assuming everything is configured correctly -- like the second build shouldn't take more than a handful of seconds (not minutes). But IIRC Sphinx has done some tinkering lately with how things are detected as out of date so maybe something broke there.
I'm not sure I totally follow, but it might be easier to give this doc change PR a shot to explain what you mean anyway! |
It isn't easy to figure out how to efficiently rebuild a single example. This use case is important because people developing gallery entries are focused on a single file and have to preview it many times. Also, writing a gallery entry can be a good way for beginners to enter a project but beginners are likely to struggle—but making this experience better will help projects gain contributors. A tweak to the docs would have made things a lot easier for me, and some adjustment to how Sphinx Gallery gets configured might make a better process automatic.
For context, I'm working on the legend guide for Matplotlib, which is a Sphinx Gallery file. I found it difficult to generate the html for that file and only that file.
The Sphinx Gallery docs helpfully point out that you can build a single example
but I found setting include_patterns to also be essential for that goal.
I added the following to conf.py:
and run with
python -msphinx -b html -D sphinx_gallery_conf.filename_pattern=../galleries/users_explain/axes/legend_guide.py . build/html
Each of those tweaks to conf.py was important.
The text was updated successfully, but these errors were encountered: