sphinx autodoc napoleon Google style docstring multiple return and args parameter sublist?

1,125 views
Skip to first unread message

David

unread,
Apr 2, 2015, 5:22:39 PM4/2/15
to sphinx...@googlegroups.com
I am using napoleon to autodoc Google style docstrings. It looks it doesn't automatically creates a list to describe each element in a tuple that a function returns. That is, if I am returning multiple output arguments, how best to document this?

Another issue is creating a sublist for a Args parameter. If a parameter is dict or a class and I want to document keys or methods the parameter must have, how best to do that?

It would be nice if I could write
def foo(arg):
 
'''basic usage

  Args:
    arg (dict): must contain the keys:
      '
configfile': specifies config file
      '
threshold': minimum value to use in algorithm

  Returns:
    numPeaks (int): number of peaks above threshold
    peakPos (list): list of peak positions
  '''



I asked this on stack overflow and got further, the suggestion for the return arguments was to first document the fact that you return a tuple. However I still find I need to manually introduce restructured text for the sublist. i.e:
  Returns:  
   
(tuple): peak information output:

       
* numPeaks (int): blah
       
* peakPos (list): blah


But I'd rather not waste space documenting the fact that the return is a tuple (although maybe I should to be more precise).
Reply all
Reply to author
Forward
0 new messages