3

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?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Micromegas
  • 1,499
  • 2
  • 20
  • 49
  • 1
    Instead of Numpydoc, you could try the Napoleon extension: http://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html – mzjn Aug 29 '19 at 09:29
  • Absolutely that did the trick!! Thanks so much mate!! Weird that it didn't work with numpydoc, I filed a bug report, maybe that helps to fix it with this extension. Cheers – Micromegas Aug 29 '19 at 09:34

0 Answers0