Python Sphinx自动摘要链接到导入的成员文档

Python Sphinx自动摘要链接到导入的成员文档,python,package,python-sphinx,toctree,Python,Package,Python Sphinx,Toctree,我试图记录一个有点复杂的python包,它有几个私有子模块 i、 e 然后在\uuuu init\uuuuu.py中,我有: from package._info import __authors__, __copyright__, __license__, \ __contact__, __version__, __title__, __desc__ from package._core import funcA, funcB, class

我试图记录一个有点复杂的python包,它有几个私有子模块

i、 e

然后在
\uuuu init\uuuuu.py
中,我有:

from package._info import __authors__, __copyright__, __license__, \
                          __contact__, __version__, __title__, __desc__

from package._core import funcA, funcB, classA, classB

try:
    from package._extra1 import funcE1A, funcE1B, funcE1C
except ImportError:
    _extra1_requirement = "Requires external_package>=x.y"

    def funcE1A(*args, **kwargs):
        raise NotImplementedError(_extra1_requirement)

    def funcE1B(*args, **kwargs):
        raise NotImplementedError(_extra1_requirement)

    def funcE1C(*args, **kwargs):
        raise NotImplementedError(_extra1_requirement)
这样所有的公共成员都可以在
名称空间中使用
然而,当我在sphinx中使用autosummary来记录我的包时

.. automodule:: package

Core Functions
--------------
.. autosummary::
    :toctree: reference/

    funcA
    funcB

Core Classes
------------
.. autosummary::
    :toctree: reference/

    classA
    classB

Extra 1 Functions
-----------------
.. autosummary::
    :toctree: reference/

    funcE1A
    funcE1B
    funcE1C
它为
reference/package.member
以及汇总表生成autodoc文件,但是如果我将文档更改为

.. automodule:: package

Core Functions
--------------
.. currentmodule:: package._core
.. autosummary::
    :toctree: reference/

    funcA
    funcB

Core Classes
------------
.. currentmodule:: package._core
.. autosummary::
    :toctree: reference/

    classA
    classB

Extra 1 Functions
-----------------
.. currentmodule:: package._extra1
.. autosummary::
    :toctree: reference/

    funcE1A
    funcE1B
    funcE1C
它生成指向文档页面的链接,但是这些页面现在命名为
reference/package.private\u submodule.member
,而不是
reference/package.member

我想将主要文档页面保留为
reference/package.member
,并让autosummary生成指向这些页面的链接。然而,尽管经过多次搜索和查阅文档,我仍然无法找到任何帮助,我发现了这个问题

在取出私有子模块时,我对自动生成的文件进行了重命名,autosummary生成了以下文件:

.. currentmodule:: package.submodule
这一行是错误的来源,因为重构需要将其更改为:

.. currentmodule:: package
发现这一点后,我重命名了一些文件并重新运行构建,由autosummary生成的新文件被正确链接

.. currentmodule:: package