尽管在本地生成Sphinx文档时出现了一些Python模块,但readthedocs.io上并没有显示这些模块

2024-06-16 06:36:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试为一个Python项目生成Sphinx文档,并使用Read-the-Docs托管文档。项目代码为here。当我运行make clean && make html在本地生成文档时,文档将生成并包含我的所有四个Python模块: Local Docs

我已经阅读了连接到Github的文档来生成关于新提交的文档,它成功地为我的Python模块的2/4生成了文档,但其中两个模块没有出现。“读取文档”生成运行时似乎没有错误: 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


Tags: of文档pydocspackagesourcehomemake
1条回答
网友
1楼 · 发布于 2024-06-16 06:36:32

始终检查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

相关问题 更多 >