Commit ad6251a
committed
docs(conf): Add missing-reference handler to resolve py:data as :class: links
why: sphinx-autodoc-pytest-fixtures wraps every fixture return-type
identifier in a :class: cross-reference so that Sphinx and intersphinx
can resolve it. Sphinx 8.x's Python domain only searches py:class and
py:exception entries for :class: references; TypeAliases land in the
inventory as py:data instead. The result is a broken (unlinked) type
name in the fixture summary table for any TypeAlias return type.
The same handler was added to unihan-etl's conf.py for the same reason;
this brings libvcs in line with that approach.
what:
- Import typing as t at the top of conf.py
- Guard docutils / sphinx type imports under TYPE_CHECKING so mypy gets
accurate types without a runtime dependency on types-docutils being
present in every environment
- Add _on_missing_class_reference(): when a :class: reference cannot be
resolved, fall back to searching all Python-domain objects so that
py:data entries (TypeAliases) are found and linked
- Add setup(app) to wire the handler into Sphinx's missing-reference
event1 parent db8e3d5 commit ad6251a
1 file changed
+37
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
7 | 14 | | |
8 | 15 | | |
9 | 16 | | |
| |||
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
0 commit comments