autodoc指令在本地有效,但在readthedocs上无效 [英] autodoc directive works locally but not on readthedocs

查看:81
本文介绍了autodoc指令在本地有效,但在readthedocs上无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的存储库位于github上的此处:

本地生成的html文件如下所示:

为什么会这样?

解决方案

您有用Cython编写并编译为C的模块.我认为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?

解决方案

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

这篇关于autodoc指令在本地有效,但在readthedocs上无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆