我有一个Python文件(lib.py),里面有一些没有类的函数。每个函数都具有以下风格:
def fnc1(a,b,c):
'''
This fonction does something.
:param a: lalala
:type a: str
:param b: hahaha
:type b: int
:param c: hohoho
:type c: int
:rtype: int
'''
print a
d = b + c
return d
我只想用Sphinx文档每个函数(输入和输出)。
在执行sphinx-quickstart之后,我使用我的lib.py在conf.py中定义了路径。
但是生成的HTML文件(欢迎页)是空的。
如果我在index.rst中自己编写:.. function:: func1(a,b,c)
This fonction does something.
:param a: lalala
:type a: str
:param b: hahaha
:type b: int
:param c: hohoho
:type c: int
:rtype: int
可以,它会在HTML文件中显示输入和输出。 但如何自动完成呢?
通常来说,我认为需要在执行 sphinx-apidoc -o 后在 lib.rst 中进行操作, 但是在 lib.rst 中只有:
lib module
==================
.. automodule:: lib
:members:
:undoc-members:
:show-inheritance:
有人能逐步解释一下我必须做什么吗?