问题描述
我正在尝试为Python项目生成Sphinx文档,并使用Read The Docs托管文档。项目代码为here。当我运行make clean && make html
在本地生成文档时,该文档将生成并具有我的所有四个python模块:
Local Docs
我已经阅读了连接到Github的文档,以生成有关新提交的文档,并且该文档成功生成了我的python模块的2/4的文档,但是其中两个没有出现。 Read the Docs构建似乎没有错误运行: Read The Docs
我的本地版本有一些警告,但它们似乎与未出现的文档无关:
$ make clean && make html
Removing everything under '_build'...
Running Sphinx v3.2.1
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 3 source files that are out of date
updating environment: [new config] 3 added,0 changed,0 removed
reading sources... [100%] source/modules
/<home>/argos-translate/argostranslate/package.py:docstring of argostranslate.package.Package:24: WARNING: Unexpected indentation.
/<home>/argos-translate/argostranslate/package.py:docstring of argostranslate.package.Package:30: WARNING: Block quote ends without a blank line; unexpected unindent.
/<home>/argos-translate/argostranslate/translate.py:docstring of argostranslate.translate.Language:7: WARNING: Unexpected indentation.
/<home>/argos-translate/argostranslate/translate.py:docstring of argostranslate.translate.Language:8: WARNING: Block quote ends without a blank line; unexpected unindent.
looking for Now-outdated files... none found
pickling environment... done
checking consistency... /<home>/argos-translate/docs/source/modules.rst: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] source/modules
generating indices... genindex py-modindexdone
writing additional pages... searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded,5 warnings.
The HTML pages are in _build/html.
Here's a link to the Read The Docs documentation。
解决方法
始终检查RTD生成日志中的“警告”或“错误”。
对于您来说,latest build log对于未在RTD上记录的两个模块具有以下相关警告:
WARNING: autodoc: failed to import module 'gui' from module 'argostranslate'; the following exception was raised:
No module named 'ctranslate2'
...
WARNING: autodoc: failed to import module 'translate' from module 'argostranslate'; the following exception was raised:
No module named 'ctranslate2'
这意味着尚未将必需的依赖项指定为安装在RTD上。确保在项目中指定ctranslate2
作为要求,以便RTD可以安装它。有关完整的详细信息,请参见Specifying Dependencies。