sphinx-automodapi icon indicating copy to clipboard operation
sphinx-automodapi copied to clipboard

Freeze during generation of HTML (with typing)

Open mikir opened this issue 2 years ago • 8 comments

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                   

mikir avatar Oct 07 '22 07:10 mikir

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?

pllim avatar Oct 07 '22 12:10 pllim

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.

mikir avatar Oct 07 '22 12:10 mikir

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

pllim avatar Oct 07 '22 12:10 pllim

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.

mikir avatar Oct 07 '22 13:10 mikir

Hopefully you'll find a resolution there. Good luck!

pllim avatar Oct 07 '22 13:10 pllim

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.

Mi-La avatar Oct 11 '22 08:10 Mi-La

Oh, interesting. Thanks for reporting back!

pllim avatar Oct 11 '22 12:10 pllim

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!

pllim avatar Oct 11 '22 21:10 pllim