sphinx-autoapi: autodoc.typehints integration not working
When inspecting the data
returned by parse_functiondef
I can see that the type hints are correctly picked up by autoapi. However, including sphinx.ext.autodoc
and specifying a autodoc_typehints
config value of “description” or “none” does not seem to have any effect at all.
I’m not sure how exactly the integration with sphinx.ext.autodoc
works so it’s hard to tell what might be going wrong. Do you have any pointers? It might just be an obvious oversight on my side.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (3 by maintainers)
Commits related to this issue
- Fixed type annotations being shown for only a single module Closes #273 — committed to readthedocs/sphinx-autoapi by AWhetter 3 years ago
Apologies for taking so long to address this critical issue. This should be fixed in v1.8.1.
@brentyi, thanks for providing an example to reproduce this. Looking through what you have posted here and going through my own docs, I can confirm that type hints are indeed added correctly for a single module but get cleared for all others.
I think the right thing to do here is to add support for overloads to
autodoc.typehints
and to do so by adding a new event that we can connect to it and register both overloads and regular type signatures with it. We’re kinda hooking into a private part of Sphinx by usingtemp_data
I think so it would be nice to have a public way of declaring these type hints.