【问题标题】:Sphinx ignoring imports (py2.7)狮身人面像忽略进口(py2.7)
【发布时间】:2019-07-12 17:26:39
【问题描述】:

Sphinx 似乎忽略了自动文档模块中的导入。

doc/conf.py 摘录

import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.setrecursionlimit(1500)

doc/code.rst

Auto Generated Documentation
============================

Utils
-----

.. automodule:: myproject.utils
   :members:

myproject/utils/__init__.py

from data import *
from hashing import *
from redis import *
from cookie import *
from route import *

def method_whose_docstring_is_picked_up(string):
    """I'm being autodoc'ed. =)
    """

X import Y 中的所有类或函数都没有被自动文档化。直接在__init__.py 中的任何内容都被拾取,而不是导入。我尝试显式导入每个对象,但没有解决任何问题。

【问题讨论】:

标签: python-2.7 python-sphinx


【解决方案1】:

事实证明,import-members 可以做到这一点,但它也会拖入所有 std-lib 和第三方导入,从而弄乱你的 sphinx 文档。

Sphinx, using automodule to find submodules

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-05
    • 1970-01-01
    • 2020-11-25
    • 2010-11-28
    • 1970-01-01
    相关资源
    最近更新 更多