Skip to content

Commit 38dd213

Browse files
committed
Let autoapi also discover all _os.py modules
When working on the extension, I was made aware that the `_os.py` files where never parsed by autoapi. Meaning the links for the supported Operating Systems would not work. This fix resolves that issue
1 parent 96966ee commit 38dd213

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/source/conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import sys
1616
from pathlib import Path
1717

18+
from sphinx.application import Sphinx
19+
1820
sys.path.insert(0, os.path.abspath("./contributing"))
1921

2022
for path in map(str, Path("../../submodules/").resolve().iterdir()):
@@ -179,3 +181,14 @@
179181
# https://github.com/sphinx-doc/sphinx/issues/4961
180182
"ref.python",
181183
]
184+
185+
186+
def do_not_skip_os_classes(app: Sphinx, what: str, name: str, obj, skip: bool, options: list[str]) -> bool:
187+
if name.endswith("._os") and what == "module":
188+
skip = False
189+
return skip
190+
191+
192+
def setup(sphinx: Sphinx) -> None:
193+
if "autoapi.extension" in extensions:
194+
sphinx.connect("autoapi-skip-member", do_not_skip_os_classes)

0 commit comments

Comments
 (0)