我知道我可以document (module) constants in sphinx与任何一个
#: a tuple of primes
primes = (2, 3, 5, 7, 11, 13, 17)
或者
primes = (2, 3, 5, 7, 11, 13, 17)
"""a tuple of primes"""
然后会出现在斯芬克斯生成的文档中;即,它看起来像这样:
somemodule.primes
= (2, 3, 5, 7, 11, 13, 17)
a tuple of primes
但是如果数据是一个很长的列表呢?然后我希望能够在文档中有一个docstring,但在文档中没有实际的数据本身。你知道吗
这是我想要的文件:
somemodule.primes
a tuple of primes
我有办法做到这一点吗?你知道吗
完整性:
我运行了sphinx-quickstart
并启用了autodoc:
autodoc: automatically insert docstrings from modules (y/n) [n]: y
我唯一添加到index.rst
的是:
``somemodule``
**************
.. automodule:: somemodule
:members:
其中somemodule.py
包含:
#: a tuple of primes
primes = (2, 3, 5, 7, 11, 13, 17)
然后我在conf.py
中调整sys.path
,这样somemodule.py
就在那条路径上。你知道吗
我结束了在
somemodule.py
中没有任何somemodule.primes
的文档(这使得sphinx忽略了它),并在index.rst
中放置了一个手动文档到目前为止,我还没有找到直接在
somemodule.py
中做类似事情的方法。你知道吗相关问题 更多 >
编程相关推荐