![](/img/trans.png)
[英]Python-sphinx: documentation of a child class won't show when "autodoc_mock_imports" is enabled
[英]Sphinx autodoc mock imports results in undocumented object
我正在尝试记录从模拟导入(foo.FOO)派生的常量
foo.py
"""Foo module."""
from asdf import qwerty
FOO = qwerty.FOO
"""Foo constant."""
ASDF = 1
"""ASDF."""
def foo():
"""Return foo :py:const:`foo.FOO` :py:const:`foo.ASDF`."""
return FOO
配置文件
import os
import sys
sys.path.insert(0, os.path.abspath(os.pardir))
project = 'sphinx'
copyright = '2021, sphinx'
author = 'sphinx'
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
exclude_patterns = []
html_theme = 'alabaster'
html_static_path = ['_static']
autodoc_mock_imports = ['asdf']
nitpicky = True
#nitpick_ignore = [
# ('py:class', 'foo.FOO'),
#]
当我运行make html SPHINXOPTS=-Ea
,我得到了生成的文档。
但我希望当我模拟 foo.FOO 的导入时(见上图)。
狮身人面像:4.3.0
这是功能还是错误?
这实际上是一个错误并已修复https://github.com/sphinx-doc/sphinx/pull/9905
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.