sphinx-autodoc-typehints: WARNING: error while formatting signature: Handler for event 'autodoc-process-signature' threw an exception
Hello,
i’m currently trying to use sphinx-autodoc-typehints to create a nice documentation for my project pyage (https://github.com/Timtam/pyage). I do have an issue however. When i’m annotating a method like this:
def quit(self) -> None:
"""
This method will tell the game loop to quit as soon as possible, releasing all resources in the process.
Parameters
----------
Returns
-------
:obj:`None`
"""
sphinx-autodoc-typehints will fail with an indescriptive error when processing the signature of that method: WARNING: error while formatting signature for pyage.app.App.quit: Handler <function process_signature at 0x00000280E14DCC10> for event ‘autodoc-process-signature’ threw an exception (exception: ‘quit’)
I’ve configured my sphinx-autodoc-typehints as follows:
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
]
napoleon_use_param = True
Do you have any idea of what might cause this issue, or how I can help you digging deeper into the issue?
I’m running Python 3.8.2 with sphinx 3.3.1 and sphinx-autodoc-typehints 1.11.1. Thanks.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 15 (6 by maintainers)
I think a PR from me side is out of scope. I’m not a Sphinx / Sphinx extension developer and I have no knowledge about this particular extension nor why a meta class should break the code or cause such a hard error.
In addition, I tried multiple time to debug Sphinx code, but it’s just a nightmare how it’s programmed and documented. It’s still a nice tools and it works, but fixing problems in Sphinx is a nightmare as it has no clear and documented software architecture.
Sorry.
If you like, I can try to make a minimal example and also try to narrow it down.
Thanks. I tried that and it gave me no output whatsoever, but I managed to find the troublemaker anyway. My class is annotated with the singleton decorator from a package called py-singleton (https://pypi.org/project/py-singleton/). As soon as I remove the decorator, everything works fine. I guess that thing messes my class up some way or another. I’ll see if I can find something else to simplify my process of working with singletons which is more compatible with sphinx.