【问题标题】:autodoc directive works locally but not on readthedocsautodoc 指令在本地工作,但不适用于 readthedocs
【发布时间】:2017-07-08 18:19:32
【问题描述】:

我的 repo 位于 github 上:https://github.com/AshleySetter/optoanalysis

文档位于https://github.com/AshleySetter/optoanalysis/tree/master/optoanalysis/docs

ReadTheDocs 没有失败,但生成的文档(在此处托管:https://optoanalysis.readthedocs.io/en/latest/)不显示应由 ..autodoc:: 命令生成的文档字符串。

但是它在本地运行良好,并在我打开 build/html/index.html 文件时显示文档。

在 ReadTheDocs 上看起来像:

而本地构建的 html 文件如下所示:

为什么会这样?

【问题讨论】:

    标签: git github python-sphinx read-the-docs


    【解决方案1】:

    您有用 Cython 编写并编译为 C 的模块。我认为是 ReadTheDocs doesn't support C extensions。您必须保护在 ReadTheDocs 生成的导入。

    类似this:

    import os
    if 'READTHEDOCS' not in os.environ:
        import cython_generated_ext
    

    【讨论】:

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