readthedocs / sphinx-autoapi

A new approach to API documentation in Sphinx.
https://sphinx-autoapi.readthedocs.io/
MIT License
415 stars 126 forks source link

autoapi-inheritance-diagram: `TypeError: '<' not supported between instances of 'NoneType' and 'str'` #396

Closed kenodegard closed 12 months ago

kenodegard commented 1 year ago

If a tooltip cannot be derived from the cls.__doc__ we risk performing a sort between None and strs:

To reproduce:

$ mkdir scratch
$ cd scratch
$ echo "from setuptools.command.sdist import sdist" > code.py
$ echo ".. autoapi-inheritance-diagram:: code.sdist" > index.rst
$ echo "extensions = ['autoapi.extension']" > conf.py
$ echo "autoapi_dirs = ['.']" >> conf.py
$ sphinx-build -M html . _build
Running Sphinx v4.2.0
[AutoAPI] Reading files... [100%] /Users/kodegard/scratch/sphinx-error/code.py
[AutoAPI] Mapping Data... [100%] /Users/kodegard/scratch/sphinx-error/code.py
[AutoAPI] Rendering Data... [ 50%] conf
[AutoAPI] Rendering Data... [100%] code

[autosummary] generating autosummary for: index.rst
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 4 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... /Users/kodegard/scratch/sphinx-error/autoapi/index.rst: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] index
Exception occurred:
  File "/Users/kodegard/.conda/arm64/23.3.1/3.10/envs/docs/lib/python3.10/site-packages/sphinx/ext/inheritance_diagram.py", line 300, in generate_dot
    for name, fullname, bases, tooltip in sorted(self.class_info):
TypeError: '<' not supported between instances of 'NoneType' and 'str'
The full traceback has been saved in /var/folders/9l/7sv3nyt57w74wg3l3yvzz4b40000gn/T/sphinx-err-ismlgube.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!

sphinx-err-ismlgube.log