如何在 Sphinx 文档中将成员注释为摘要?
Posted
技术标签:
【中文标题】如何在 Sphinx 文档中将成员注释为摘要?【英文标题】:How to annotate a member as abstract in Sphinx documentation? 【发布时间】:2013-07-24 08:39:15 【问题描述】:以下两个属性定义在 Sphinx autodoc
html 输出中显示完全相同:
@property
def concrete(self):
"""This is the concrete docstring"""
pass
@abstractproperty
def abstract(self):
"""This is the abstract docstring"""
pass
Sphinx 有没有办法用某种标识符来注释抽象方法?我希望在我的文档中清楚地表明我的 ABC 的哪些成员需要实现,以及在定义了所需的那些成员后,你会获得哪些 mixin 免费赠品。
【问题讨论】:
【参考方案1】:Sphinx 似乎无法做到这一点。自 2011 年以来,它在 Sphinx's bitbucket 被标记为未解决问题,并被标记为 Sphinx 未来版本的里程碑。
【讨论】:
bitbucket 链接不再起作用。见github.com/sphinx-doc/sphinx/issues/744。 github.com/sphinx-doc/sphinx/issues/744 已于 2019 年 5 月 19 日关闭以上是关于如何在 Sphinx 文档中将成员注释为摘要?的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 Sphinx 为 Python 属性设置器生成文档?