【问题标题】:Make Read the Docs include autodoc documentation for special-members?使阅读文档包括特殊成员的自动文档文档?
【发布时间】:2015-03-16 05:55:13
【问题描述】:

我有一个包含两个记录在案的全局特殊成员的模块。

在本地运行 Sphinx 会创建包含其文档的文档,但 Read the Docs 不会。它改为使用内置类型的文档。

我尝试了两种样式:#: 和定义后的文档字符串。我已经多次阅读autodoc 的文档和Read the Docs entry on it。我无法弄清楚我错过了什么,因为我什至没有在 Read the Docs 上看到任何构建错误。

有什么想法吗?

【问题讨论】:

  • 你能显示你用来构建文档的完整命令吗?
  • 来自readthedocs.org/projects/argf/builds/3296530: python /home/docs/checkouts/readthedocs.org/user_builds/argf/envs/latest/bin/sphinx-build -T -b readthedocs -d _build/doctrees-readthedocs -D language=en . _build/html
  • 我正打算进来告诉你,就像你在sphynx 中所做的那样,在成员之前直接用#: 告诉你......但看起来你已经尝试过了,所以取而代之的是+1,希望您能得到一个好的答案:)
  • 您使用的版本可能与 RTD 使用的版本不同。看起来在各种版本中都有一些特殊成员的错误。见github.com/sphinx-doc/sphinx/issues?q=Autodoc+special

标签: python python-sphinx read-the-docs autodoc


【解决方案1】:

如果您使用 Napoleon 扩展来处理 NumPy 或 Google 样式的文档字符串,您可以在 conf.py 中为此设置一个配置标志

http://sphinx-doc.org/ext/napoleon.html?highlight=special#confval-napoleon_include_special_with_doc

如果我没记错的话,还有一个 autodoc 指令:

http://sphinx-doc.org/ext/autodoc.html?highlight=member#event-autodoc-skip-member

通过实施此方法,您可以细粒度地选择哪些成员将包含在文档中,哪些不包含在文档中。

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多