Sphinx and Numpydoc throws parse error when inheriting from third party package

354 Views Asked by At

I'm trying to use Sphinx and numpydoc to document my code, yet very unsuccessfully so far. When I m trying to make html I get this very confusing error:

Exception occurred:
  File "/Users/micromegas/anaconda3/envs/sphinx4/lib/python3.7/site-packages/numpydoc/docscrape.py", line 330, in _parse_see_also
    raise ParseError("%s is not a item name" % line)
numpydoc.docscrape.ParseError: order, __len__  which are identical is not a item name in 'Returns the number of nodes in the graph.\n\nReturns\n-------\nnnodes : int\n    The number of nodes in the graph.\n\nSee Also\n--------\norder, __len__  which are identical\n\nExamples\n--------\n>>> G = nx.path_graph(3)  # or DiGraph, MultiGraph, MultiDiGraph, etc\n>>> len(G)\n3'
The full traceback has been saved in /var/folders/kx/fc27k_8n52qcd8cylq98z7ph0000gn/T/sphinx-err-f9d7ufke.log, if you want to report the issue to the developers.

This docstring that sphinx is unable to parse is from a dependency from which my code inherits a class. But this dependency is using Sphinx and numpy docstyle itself (https://github.com/networkx/networkx). So I can get rid of the error by not inheriting from that specific class, but that's not a real solution.

I was trying to change the conf.py like to adapt it to the third party package. No success. Also maybe I could prevent sphinx from including it in the doc? Idk....

Has anyone an idea what I could try?

0

There are 0 best solutions below