sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.46k stars 2.1k forks source link

AssertionError isinstance #10554

Open leguyader opened 2 years ago

leguyader commented 2 years ago

Describe the bug

With autoapi activated building the documentation fails. We don't really understand the error message or what's causing the issue and how to fix it.

How to Reproduce

$ git clone https://git.xfel.eu/SCS/ToolBox.git
$ cd ToolBox
$ git checkout autoapi-test
$ cd doc
$ make html

Expected behavior

The documentation should compile, but with autoapi it doesn't.

We get the following error:

Exception occurred:
  File "~/.local/lib/python3.8/site-packages/nbsphinx.py", line 1697, in apply
    assert isinstance(section.children[0], docutils.nodes.title)
AssertionError
The full traceback has been saved in /tmp/sphinx-err-qwdmz97v.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make: *** [Makefile:19: html] Error 2

Attached the corresponding traceback: log.txt

Your project

https://git.xfel.eu/SCS/ToolBox

Screenshots

No response

OS

unix

Python version

3.8.10

Sphinx version

4.2.0

Sphinx extensions

autoapi, nbsphinx

Extra tools

No response

Additional context

No response

leguyader commented 2 years ago

It looks like we are triggering some incompatibility between autoapi and nbsphinx. But I found this project https://forge.oasu.u-bordeaux.fr/jleconte/exo_k-public for example that uses both without problem. I confirmed it by building the documentation for this project locally.

I tried to copy some of the autoapi configuration from that exo_k project conf.py but nothing helped, we get an error from our documentation which we don't understand.

AA-Turner commented 2 years ago

Please provide a minimal reproducing example, ideally one page of documentation that triggers the bug.

Please also confirm it is not an issue with the extensions you mentioned but Sphinx itself.

A

leguyader commented 1 year ago

Looking for a minimal example, I found out that the error was triggered by 2 of our files having the following structure:

"""
    Class
    -----
"""

class Class:
    def __init__(self, num):
        self.num = num

The error is generated by line 3, '-----'