sphinx-autodoc-typehints is a Sphinx extension that provides full support for type hints (PEP 484) in the documentation generated by `sphinx.ext.autodoc`. It parses type annotations from Python code and renders them beautifully in reStructuredText or Markdown output. The current version is 3.9.11, and it follows a minor release cadence driven by bug fixes and compatibility with new Sphinx or Python versions.
pip install sphinx-autodoc-typehintsVerified import paths — ran on the pinned version, not inferred.
To quickly integrate `sphinx-autodoc-typehints` into your project, ensure `sphinx.ext.autodoc` is enabled in your `conf.py` first, then add `'sphinx_autodoc_typehints'` to the `extensions` list. This snippet shows a minimal `conf.py` setup, including common configuration options. Create a Python module with type-hinted functions/classes, then use `automodule` directives in your `.rst` files to generate documentation.
Upgrade your Python environment to 3.12+, or pin the library version to `<3` (e.g., `pip install 'sphinx-autodoc-typehints<3'`).
Remove these options from your `conf.py`. The `typehints_fully_qualified` option functionality is largely superseded by Sphinx's own type resolution improvements.
Ensure `extensions = ['sphinx.ext.autodoc', 'sphinx_autodoc_typehints']` (or similar order) is used in your `conf.py`.
If you wish to continue documenting return types, explicitly set `typehints_document_rtype = True` in your `conf.py`.