sphinx-automodapi
sphinx-automodapi copied to clipboard
Freeze during generation of HTML (with typing)
Consider the following source bar.py
:
import typing
class Bar:
def type_info():
return None
ROW_ANNOTATION = typing.Tuple[
str]
conf.py
:
extensions = [
'sphinx_automodapi.automodapi',
]
index.rst
:
.. automodapi:: bar
After command PYTHONPATH=. sphinx-build -b html . html_python
sphix-automodapi hangs with the following output:
PYTHONPATH=. sphinx-build -b html . html_python
Running Sphinx v5.3.0+/a5588443
loading pickled environment... done
[autosummary] generating autosummary for: api/bar.Bar.rst, index.rst
[automodsumm] index.rst: found 1 automodsumm entries to generate
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: [extensions changed ('sphinx_automodapi.automodapi')] 2 added, 0 changed, 0 removed
reading sources... [ 50%] api/bar.Bar
I am not sure if we ever updated this to work with annotation. Does it work if you use sphinx.ext.napoleon
instead of this package?
Unfortunatelly it doesn't. sphinx.ext.napoleon
gives the same result:
Running Sphinx v5.3.0+/61daeadb
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: [extensions changed ('sphinx.ext.napoleon')] 2 added, 0 changed, 0 removed
reading sources... [ 50%] api/bar.Bar
We use typing heavily and it works somehow but except of this construct.
Note: I found out that it hangs only if I ran the example with sphinx_automodapi.automodapi
before. The reason is directory api generated by automodapi. If I remove this directory, sphinx.ext.napoleon
does not hang.
If sphinx.ext.napoleon
also hangs, probably an issue with Sphinx, and not just sphinx-automodapi
? I would suggest you get a reproducible example without sphinx-automodapi and report that upstream. Our devs are not involved with Sphinx itself, unfortunately.
Also, how did you get Sphinx v5.3.0? They only have v5.2.3 right now according to https://github.com/sphinx-doc/sphinx/releases
OK, I'll report this upstream. Many thanks for such quick feedback.
Regarding Sphinx v5.3.0, I just installed the latest unreleased package using pip install git+https://github.com/sphinx-doc/sphinx
.
Hopefully you'll find a resolution there. Good luck!
Please see discussion here https://github.com/sphinx-doc/sphinx/issues/10907. It seems that it is really related only to automodapi
. With napoleon
it works if you purge api
directory generated by automodapi
before run.
Oh, interesting. Thanks for reporting back!
Someone would have to spend some time debugging automodapi to see what exactly is causing this problem. Not sure if our core developers currently have time for this. So if you want to investigate and submit a patch, it would be greatly appreciated. Thanks!