【发布时间】:2015-08-01 16:11:29
【问题描述】:
我想要自动记录模块变量,但它不起作用。文档中缺少所有变量...我该如何解决这个问题,所以 autodoc 会列出每个模块变量?
mypackage/__init__.py:
class __init__:
test = 'test'
_test = '_test'
__test = '__test'
__test__ = '__test__'
__author__ = 'author'
__email__ = 'author_email'
__description__ = 'description'
__version__ = 'version'
还有文档图片:
【问题讨论】:
-
下划线的模块被 Python 最佳实践视为内部模块,我猜 autodoc 默认情况下不会记录它们。您可以查看 Sphinx 文档以获取此选项或明确设置
__all__以告知您要导出的模块变量。 -
我试过了,但没有运气。我认为这是一个错误......
标签: python-sphinx autodoc