首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sphinx - and ` modules‘,我缺少了几个模块的内容

Sphinx - and ` modules‘,我缺少了几个模块的内容
EN

Stack Overflow用户
提问于 2022-11-29 02:28:23
回答 1查看 39关注 0票数 1

回购链接:https://github.com/Eric-Cortez/aepsych-fork

问题:当我运行make html时,我在生成sphinx文档时遇到了一个问题,除了aepsych.database、aepsych.plotting和aepsych.server之外,大部分模块都是生成的。

文件结构:

代码语言:javascript
复制
    (root)
    aepsych-fork/
   |__ aepsych/      <--- docs in this dir 
   |__ sphinx/
   |   |__ build/
   |   |__ Makefile
   |   |__ make.bat
   |   |__ source/
   |       |___conf.py
   |       |___index.rst
   | **other files**

conf.py路径

代码语言:javascript
复制
    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但是,今天我尝试重新构建狮身人面像文档,但是遇到了一个错误。

代码语言:javascript
复制
    WARNING: autodoc: failed to import module 'acquisition.bvn' 
    from module 'aepsych'; the following exception was raised:
    No module named 'gpytorch' 

Gpy手电是在aepsych模块中使用的一个依赖项,但我不想为gpy手电筒模块生成文档。我做了一些研究并补充说

代码语言:javascript
复制
    autodoc_mock_imports = ["botorch", 'gpytorch', "torch"]

对于aepsych-叉/sphinx/ most . of,它解决了缺少的模块错误,并为三个缺少的模块生成了大部分的docs接受。我很难找到这些文件的文档没有生成的原因,因为当我运行make html时,控制台中没有任何错误。

下面是控制台输出:

代码语言:javascript
复制
    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文件是空的。

代码语言:javascript
复制
    import sys

    from ..config import Config
    from .db import Database


    __all__ = [
      "Database" 
    ]

    Config.register_module(sys.modules[__name__])

我将上面的代码添加到databases/__init__.py中,但是文档仍然没有生成。

有没有人对如何解决这个问题有任何建议?

EN

回答 1

Stack Overflow用户

发布于 2022-11-30 18:55:14

我重新创建了一个包含所有依赖项的conda环境,并且仍然得到了一个错误。警告: autodoc:未能从模块‘aepsych’导入模块'acquisition.bvn‘;引发了以下异常:没有名为'botorch.sampling.normal’的模块,因此我在sphinx/conf.py . No中添加了autodoc_mock_imports =“bo手电”,从而解决了这个问题。我可能错过了一些依赖关系。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74608512

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档