|
37 | 37 |
|
38 | 38 | # If your documentation needs a minimal Sphinx version, state it here. |
39 | 39 | # |
40 | | -needs_sphinx = "5" |
| 40 | +needs_sphinx = "6.2" |
41 | 41 |
|
42 | 42 | # Add any Sphinx extension module names here, as strings. They can be |
43 | 43 | # extensions coming with Sphinx (named "sphinx.ext.*") or your custom ones. |
|
103 | 103 | # pylint: disable-next = consider-using-namedtuple-or-dataclass |
104 | 104 | intersphinx_mapping = { |
105 | 105 | "python": ("https://docs.python.org/", None), |
| 106 | + "PyQt5": ("https://www.riverbankcomputing.com/static/Docs/PyQt5/", None), |
106 | 107 | "spyder": ("https://docs.spyder-ide.org/current/", None), |
107 | 108 | } |
108 | 109 |
|
| 110 | +# Warning suppression |
| 111 | +suppress_warnings = [] |
| 112 | + |
| 113 | +# Nitpick warning ignore list |
| 114 | +nitpick_ignore_regex = { |
| 115 | + # Spyder modules currently not included in the build |
| 116 | + ( |
| 117 | + "py:.+", |
| 118 | + # pylint: disable-next = line-too-long |
| 119 | + "spyder.(app|config|fonts|images|locale|plugins|tests|utils|widgets|windows).*", # noqa: E501 |
| 120 | + ), |
| 121 | + # Numpydoc optional |
| 122 | + ("py:class", "optional"), |
| 123 | + # Typing params |
| 124 | + ("py:.+", ".*_P"), |
| 125 | + ("py:.+", ".*_RT"), |
| 126 | + ("py:.+", ".*_T"), |
| 127 | + # Cannot use type aliases to fix refs inside type aliases or class bases |
| 128 | + ("py:class", "asyncio.events.AbstractEventLoop"), |
| 129 | + ("py:class", "concurrent.futures._base.Future"), |
| 130 | + # Type aliases don't work properly in Sphinx <9 |
| 131 | + ("py:class", "LoopID"), |
| 132 | + ("py:class", "OptionSet"), |
| 133 | + ("py:class", "spyder.api.preferences.OptionSet"), |
| 134 | +} |
| 135 | + |
| 136 | + |
109 | 137 | # -- Options for HTML output ------------------------------------------- |
110 | 138 |
|
111 | 139 | # The theme to use for HTML and HTML Help pages. See the documentation for |
|
135 | 163 | # so a file named "default.css" will overwrite the builtin "default.css". |
136 | 164 | html_static_path = ["_static"] |
137 | 165 |
|
138 | | -# Warning suppression |
139 | | -suppress_warnings = [] |
140 | | - |
141 | 166 |
|
142 | 167 | # -- Options for HTMLHelp output --------------------------------------- |
143 | 168 |
|
|
260 | 285 | # "qstylizer", |
261 | 286 | ] |
262 | 287 |
|
| 288 | +# Configure type aliases for signatures |
| 289 | +autodoc_type_aliases = { |
| 290 | + # Actual type aliases |
| 291 | + "LoopID": "spyder.api.asyncdispatcher.LoopID", |
| 292 | + "OptionSet": "spyder.api.preferences.OptionSet", |
| 293 | + # Ref name aliases |
| 294 | + "AbstractEventLoop": "asyncio.AbstractEventLoop", |
| 295 | + "asyncio.AbstractEventLoop": "asyncio.AbstractEventLoop", |
| 296 | + "asyncio.events.AbstractEventLoop": "asyncio.AbstractEventLoop", |
| 297 | + "Future": "concurrent.futures.Future", |
| 298 | + "concurrent.futures.Future": "concurrent.futures.Future", |
| 299 | + "concurrent.futures._base.Future": "concurrent.futures.Future", |
| 300 | +} |
| 301 | + |
| 302 | +# Monkeypatch to fix type aliases not working in classmethods with Sphinx |
| 303 | +# See sphinx-doc/sphinx#10333 |
| 304 | +# pylint: disable-next = wrong-import-position |
| 305 | +from sphinx.util import inspect # noqa: E402 |
| 306 | + |
| 307 | +inspect.TypeAliasForwardRef.__repr__ = lambda self: self.name |
| 308 | +inspect.TypeAliasForwardRef.__hash__ = lambda self: hash(self.name) |
| 309 | + |
263 | 310 | # Set list of modules and patterns to ignore in the autosummary template |
264 | 311 | autosummary_context = { |
265 | 312 | "ignore_module_pattern": "tests", |
|
276 | 323 | if "autodoc" in tags: # noqa: F821 |
277 | 324 | autosummary_generate = True |
278 | 325 | os.environ["SPHINX_AUTODOC"] = "1" |
| 326 | + extensions.append("sphinx_qt_documentation") # Errors out w/o Qt installed |
279 | 327 | else: |
280 | 328 | autosummary_generate = False |
281 | | - suppress_warnings += ["autodoc", "autosummary", "toc.excluded"] |
282 | 329 | exclude_patterns += ["reference.rst"] |
| 330 | + suppress_warnings += ["autodoc", "autosummary", "toc.excluded"] |
283 | 331 |
|
284 | 332 |
|
285 | 333 | # -- Additional Directives --------------------------------------------------- |
|
0 commit comments