问题描述
我一直在尝试在 readthedocs 上为我的首个 Python 包 QutiePy 构建文档。在本地构建文档工作正常,但是当我尝试在 readthedocs 上构建时,autodoc 无法填充我的部分并给出以下警告:
WARNING: autodoc: Failed to import class 'main.register' from module 'QutiePy'; the following exception was raised:
No module named 'QutiePy'
WARNING: autodoc: Failed to import module 'gates' from module 'QutiePy'; the following exception was raised:
No module named 'QutiePy'
我尝试了 conf.py 的许多配置来尝试将我的包添加到 PATH 等,但我尝试过的一切都没有奏效。
你可以查看我使用的github repo here,我使用的是开发分支。
提前致谢。
更新:我已经发布了 RTD 日志 here
更新 2:我发布了新的 RTD 日志 here
解决方法
这里的解决方案是检查我的包是否可以从 PyPI 导入,将其添加到我的 requirements.txt 并确保在 RTD 高级设置中选择了“安装项目”。我还将 sphinxcontrib-napoleon 添加到 requirements.txt 并将其导入到 conf.py 中,尽管我不确定这是否起作用。