[英]Sphinx - ran`make html` and I am missing content for a few modules
回购链接: https://github.com/Eric-Cortez/aepsych-fork
问题:当我运行make html
生成 sphinx 文档时,我遇到了一个问题,除了 3 个模块,它们是 aepsych.database、aepsych.plotting 和 aepsych.server。
文件结构:
(root)
aepsych-fork/
|__ aepsych/ <--- docs in this dir
|__ sphinx/
| |__ build/
| |__ Makefile
| |__ make.bat
| |__ source/
| |___conf.py
| |___index.rst
| **other files**
conf.py [路径]:
import os
import sys
# from pkg_resources import get_distribution
current_dir = os.path.dirname(__file__)
target_dir = os.path.abspath(os.path.join(current_dir,
"../.."))
sys.path.insert(0, target_dir)
我尝试了什么:
我之前已经能够通过运行make html
生成此文档。 示例: https://aepsych.org/api/database.html但是,我今天尝试重建 sphinx 文档并遇到错误
WARNING: autodoc: failed to import module 'acquisition.bvn'
from module 'aepsych'; the following exception was raised:
No module named 'gpytorch'
gpytorch 是 aepsych 模块中使用的依赖项,但我不想为 gpytorch 模块生成文档。 我做了一些研究并补充说
autodoc_mock_imports = ["botorch", 'gpytorch', "torch"]
到 aepsych-fork/sphinx/conf.py,它解决了丢失的模块错误并生成了大部分文档接受三个丢失的模块。 我无法找到未生成这些文件的文档的原因,因为当我运行make html
时,我在控制台中没有收到任何错误。
下面是控制台 output:
Running Sphinx v5.0.2
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 16 source files that are out of date
updating environment: [new config] 16 added, 0 changed, 0 removed
我确实注意到阅读源没有达到 100%。 我被困在阅读资源上...... [ 25%] 基准
有人对如何解决这个问题有什么建议吗?
我确实注意到数据库/模块的__init__.py
文件是空的。
import sys
from ..config import Config
from .db import Database
__all__ = [
"Database"
]
Config.register_module(sys.modules[__name__])
我将上面的代码添加到databases/__init__.py
但文档仍然没有生成。
有人对如何解决此问题有任何建议吗?
我重新创建了一个包含所有依赖项的 conda 环境,但仍然出现错误。 警告:autodoc:无法从模块“aepsych”导入模块“acquisition.bvn”; 引发了以下异常:没有名为“botorch.sampling.normal”的模块所以我将 autodoc_mock_imports = ["botorch"] 添加到 sphinx/conf.py 并解决了这个问题。 我可能遗漏了一些依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.