我无法让sphinx在我的api中格式化docstrings。一个简单的例子是this gist,它实际上是https://github.com/rocky/python2-trepan的精简版本。
我使用的命令是:
sphinx-apidoc -o modules api.py
api.py中的docstring看起来像这样:
def debug(dbg_opts=None, start_opts=None, post_mortem=True,
step_ignore=1, level=0):
"""
Enter the debugger.
Parameters
----------
level : how many stack frames go back. Usually it will be
the default 0. But sometimes though there may be calls in setup to the debugger
that you may want to skip.
step_ignore : how many line events to ignore after the
debug() call. 0 means don't even wait for the debug() call to finish.
param dbg_opts : is an optional "options" dictionary that gets fed
trepan.Debugger(); `start_opts' are the optional "options"
dictionary that gets fed to trepan.Debugger.core.start().
Use like this::
... # Possibly some Python code
import trepan.api # Needed only once
... # Possibly some more Python code
trepan.api.debug() # You can wrap inside conditional logic too
[etc.]
"""