It could be a dependency change, but I don't see any change in Sphinx or pydata-sphinx-theme based on the page footers. It could be sphinx-gallery, but they haven't had a particularly recent release. @ksunden what version did you use to build 3.10.0 docs?
Nothing major, that I can tell. For devdocs, we enable release mode, but even on PR builds (which are not in release mode), there's no keywords meta tag.
changed the title [-]Search: "codex" term returns no results on stable/devdocs[/-][+]Search: "codex" term returns no results on devdocs[/+]on Jan 31, 2025
This now seems broken on published docs since 3.10.1 (no matter how much I hard-refresh!) If I build locally with a new conda environment, there is no issue 😕
So the first check is whether the keyword is correctly placed in the .rst sources; e.g. grep codex gallery/lines_bars_and_markers/axline.rst should give :keywords: codex.
Also you can try to adding keywords in other plain rst doc files to exclude the influence of sphinx-gallery.
So it seems like sphinx-gallery in parallel mode is not letting us patch its header. Is that patching something that sphinx-gallery encourages or more of a hack on our part?
AFAICS there's no official mentioning of EXAMPLE_HEADER in the sphinx-gallery docs, so I believe it's just us monkey-patching sphinx-gallery.
So likely what is happening is that from conf.py we patch EXAMPLE_HEADER in the main thread, but the worker threads load the clean sphinx-gallery - config is passed into them as an object, and conf.py is not executed there. Most likely, we broke our monkey-patch ourselves through enabling parallel builds in #28617.
Ah, that's clever. I've tried to do this with a custom sphinx extension, but that did not work since the paralleliztion of the write is not not the sphinx side. Instead it's a direct joblib.Parallel in sphinx_gallery, and since it spawns new processes it always has the unpatched version.
Mid-term we might want to see whether we can push something upstream to sphinx-gallery. But that'll need some consideration. Do we want customization of the example header? Do we want keyword support? If so, is it enough to define global keywords?
As an end user, I'd be pretty happy if sphinx-gallery injected the same keyword in all of its examples. Then once I know the keyword I can use it consistently in Matplotlib, Cartopy and various other packages' docs.
I think a globally hard-coded keyword is of limited use. The only suitable name would be "gallery". But this is the technical term of the project, not quite obvious or meaningful to end-users. (or probably even more correct and less handy "gallery-entry").
A sematic name would be better, but is not general, at there very minimum there are usecases for "example" and "tutorial".
I think the minimal viable approach would be to have a global config entry for the keyword.
Second thought: Maybe we can convince sphinx-gallery to hard-coded add the keyword "example" for a start. Even though sphinx-gallery wants to move away form the "example" terminology" because it does not fit all use cases. That terminology is still quite engrained and it may be ok to still put this in a keyword.
Activity
QuLogic commented on Jan 28, 2025
Maybe you need to refresh the cached copy? I get the same results from your stable and 3.10.0 links.
rcomer commented on Jan 28, 2025
Oh yeah, stable is fine after a hard refresh. I had somehow managed to break it on three different devices!
I still get no results on devdocs. Is that expected?
QuLogic commented on Jan 29, 2025
No, this isn't expected on devdocs either. We patch in codex to all examples:
matplotlib/doc/conf.py
Lines 350 to 373 in 91d115e
but this is missing on devdocs:
It could be a dependency change, but I don't see any change in Sphinx or pydata-sphinx-theme based on the page footers. It could be sphinx-gallery, but they haven't had a particularly recent release. @ksunden what version did you use to build 3.10.0 docs?
ksunden commented on Jan 30, 2025
I used sphinx-gallery 0.18.0 (which is the most recent) I use a fresh venv when building docs, installing the doc dependencies and mpl from pypi.
Is there something different about the devdocs build?
QuLogic commented on Jan 30, 2025
Nothing major, that I can tell. For devdocs, we enable release mode, but even on PR builds (which are not in release mode), there's no keywords meta tag.
rcomer commented on Jun 30, 2025
This now seems broken on published docs since 3.10.1 (no matter how much I hard-refresh!) If I build locally with a new conda environment, there is no issue 😕
timhoffm commented on Dec 13, 2025
Why has this worked at all? I don't find any documentation on .. meta:: or :keywords: in the Sphinx docs.
It's in https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#html-metadata
which is actually a docutils feature: https://docutils.sourceforge.io/docs/ref/rst/directives.html#meta
Should we just remove the feature? I don't think it's terribly important and not quite intuitive.
Anyway, having the docs claim that it works when it doesn't is not a good state.
rcomer commented on Dec 14, 2025
I have used it quite a lot in the past, and have been frustrated since it stopped working.
The issue appears to be something to do with the parallel build. Locally, with a newly built mpl-dev conda environment
timhoffm commented on Dec 14, 2025
So the first check is whether the keyword is correctly placed in the .rst sources; e.g. grep codex gallery/lines_bars_and_markers/axline.rst should give :keywords: codex.
Also you can try to adding keywords in other plain rst doc files to exclude the influence of sphinx-gallery.
rcomer commented on Dec 14, 2025
does insert the keyword into the header of the expected page
and searching for "wibble" gives me that page.
So it seems like sphinx-gallery in parallel mode is not letting us patch its header. Is that patching something that sphinx-gallery encourages or more of a hack on our part?
timhoffm commented on Dec 14, 2025
AFAICS there's no official mentioning of EXAMPLE_HEADER in the sphinx-gallery docs, so I believe it's just us monkey-patching sphinx-gallery.
So likely what is happening is that from conf.py we patch EXAMPLE_HEADER in the main thread, but the worker threads load the clean sphinx-gallery - config is passed into them as an object, and conf.py is not executed there. Most likely, we broke our monkey-patch ourselves through enabling parallel builds in #28617.
Working on it ...
rcomer commented on Dec 14, 2025
I have established that we can re-instate it by monkey-patching for each example using the "reset_modules" option.
DOC: reinstate "codex" search term
timhoffm commented on Dec 14, 2025
Ah, that's clever. I've tried to do this with a custom sphinx extension, but that did not work since the paralleliztion of the write is not not the sphinx side. Instead it's a direct joblib.Parallel in sphinx_gallery, and since it spawns new processes it always has the unpatched version.
Mid-term we might want to see whether we can push something upstream to sphinx-gallery. But that'll need some consideration. Do we want customization of the example header? Do we want keyword support? If so, is it enough to define global keywords?
rcomer commented on Dec 14, 2025
As an end user, I'd be pretty happy if sphinx-gallery injected the same keyword in all of its examples. Then once I know the keyword I can use it consistently in Matplotlib, Cartopy and various other packages' docs.
timhoffm commented on Dec 15, 2025
I think a globally hard-coded keyword is of limited use. The only suitable name would be "gallery". But this is the technical term of the project, not quite obvious or meaningful to end-users. (or probably even more correct and less handy "gallery-entry").
A sematic name would be better, but is not general, at there very minimum there are usecases for "example" and "tutorial".
I think the minimal viable approach would be to have a global config entry for the keyword.
Second thought: Maybe we can convince sphinx-gallery to hard-coded add the keyword "example" for a start. Even though sphinx-gallery wants to move away form the "example" terminology" because it does not fit all use cases. That terminology is still quite engrained and it may be ok to still put this in a keyword.