autodoc directive works locally but not on readthedocs

荒凉一梦 提交于 2021-02-10 03:08:04

问题


My repo is located on github here: https://github.com/AshleySetter/optoanalysis

And the docs are in https://github.com/AshleySetter/optoanalysis/tree/master/optoanalysis/docs

ReadTheDocs doesn't fail but the produced documentation (hosted here: https://optoanalysis.readthedocs.io/en/latest/) doesn't display the doc strings that should be produced by the ..autodoc:: command.

However it runs fine locally and displays the documentation when I open the build/html/index.html file.

On ReadTheDocs it looks like:

Whereas the locally built html file looks like so:

Why might this be?


回答1:


You have modules written in Cython and compiled to C. I think ReadTheDocs doesn't support C extensions. You have to protect you imports to be generated at ReadTheDocs.

Something like this:

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


来源:https://stackoverflow.com/questions/44989408/autodoc-directive-works-locally-but-not-on-readthedocs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!