PyDoc: type hints for sphinx_doc_gen.py, various minor changes

Various changes in preparation for including documentation generation
in Blender's CTests (not HTML generation, as that takes much longer).

- Collect errors while building docs, print them to the stderr,
  then exit with an error exit code.
- Support passing in arguments to its `main(argv=None)`,
  so other scripts can invoke documentation generator.
- Use type hints for the doc generator, passes `mypy --strict`.
- Add a helper that type-checks the bundled scripts
  against the generated stubs - to help expose issues.

Ref !158399
This commit is contained in:
Campbell Barton 2026-05-11 22:37:57 +00:00
parent ffb3d95666
commit 49f0703fd1
3 changed files with 940 additions and 548 deletions

View file

@ -31,6 +31,7 @@ EXCLUDED_FILE_PATHS = {
"doc/python_api/sphinx_doc_gen.py",
# Use newer Python features.
"doc/python_api/check_stubs.py",
"doc/python_api/sphinx_stub_gen.py",
"doc/python_api/sphinx_stub_validate.py",