Fix some gallery files not being executed#2792
Conversation
|
regex https://regex101.com/ - remember to change to python flavor if you try it. Edit: updated regex and test data at 00h30 UTC 2026-06-19 Last edit: I invite anybody on windows to try this out, I only checked on linux which is enough for the readthedocs builds, but you may want to check windows users can use this locally too. |
8d1f58e to
3bad2f2
Compare
|
I've tested on Windows. Now it works flawlessly; We have 41 .py examples: Counted via command line
~/Documents/10_Programming/pvlib-python/docs fix_some_examples_not_run_by_sphinx* ≡
❯ find examples -mindepth 1 -type f -name "*.py" -printf x | wc -c
41And both in linux and windows it shows 40 of them are executed (while also leaving oedi example in the web): sphinx-gallery report on build - Linux
Sphinx-Gallery successfully executed 0 out of 0 files subselected by:
gallery_conf["filename_pattern"] = '^(.*)/(?!NX_)([^/]*)$'
gallery_conf["ignore_pattern"] = '__init__\\.py'
after excluding 40 files that had previously been run (based on MD5).sphinx-gallery report on build - Windows
Sphinx-Gallery successfully executed 40 out of 40 files subselected by:
gallery_conf["filename_pattern"] = '^(.*)\\\\(?!NX_)([^\\\\]*)$'
gallery_conf["ignore_pattern"] = '__init__\\.py'
after excluding 0 files that had previously been run (based on MD5).I hope you like the set of changes I propose here. Don't hesitate to point anything out, from maintenance burden to whatever else that comes to your mind. I think it would be great to have this issue solved in the short term to fix the latest documentation branch on readthedocs. |
| # import distutils before calling pd.show_versions() | ||
| # https://github.com/pypa/setuptools/issues/3044 | ||
| import distutils # noqa: F401 |
There was a problem hiding this comment.
This package was deprecated for quite some time, and finally got removed in CPython 3.12 1.
Our pipeline runs on CPython 3.12 too 2, but I guess readthedocs installs some stub to avoid breaking build processes - pure speculation from my side.
I've had to remove the import line in my python setups to compile the docs, both 3.14 (linux) and 3.12 (win). In both cases, I only installed our [doc] optional dependencies.
It was introduced quite some time ago, in #1435. The specific commit is 76972a8 (#1435). I couldn't trace what it attempts to solve, to see if it's now fixed (at pandas, probably?). Nowadays normal people use imporlib.metadata, so my guess is that we are looking at is a digital fossil. Wondering if anybody (presumably @kandersolar or @mikofski) knows if we can safely remove this.
docs/sphinx/source/referencefor API changes.docs/sphinx/source/whatsnewfor all changes. Includes link to the GitHub Issue with:issue:`num`or this Pull Request with:pull:`num`. Includes contributor name and/or GitHub username (link with:ghuser:`user`).remote-data) and Milestone are assigned to the Pull Request and linked Issue.Other suggestions for the prefix welcome. I left a warning in
NX_oedi9068.pyto explicitly state it is not run by documentation. I don't really care but I thought it may be useful to hint users before running.