一些 Python 模块没有出现在 readthedocs.io 上,尽管在本地生成 Sphinx 文档时出现了
Some Python modules don't show up on readthedocs.io despite appearing when generating Sphinx docs locally
我正在尝试为 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.
始终检查 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。
我正在尝试为 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.
始终检查 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。