Open
Description
The issue π
Consider the following project:
.
βββ package/
β βββ__init__.py
βΒ Β βββ module_A.py
βΒ Β βββ module_B.py
βββ conf.py
βββ index.rst
The content of each file:
module_A.py | module_B.py | index.rst | conf.py |
from enum import IntEnum
from .module_B import *
__all__ = ["FooA"]
class FooA(IntEnum):
ITEM_0 = 0
ITEM_1 = 1
ITEM_2 = 2 |
from enum import IntEnum
__all__ = ["FooB"]
class FooB(IntEnum):
ITEM_0 = 0
ITEM_1 = 1
ITEM_2 = 2 |
Package docs
============
.. toctree::
autoapi/index
Contents:
.. toctree::
:maxdepth: 2 |
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
project = "package"
copyright = "2015, readthedocs"
author = "readthedocs"
version = "0.1"
release = "0.1"
language = "en"
exclude_patterns = ["_build"]
pygments_style = "sphinx"
todo_include_todos = False
html_theme = "alabaster"
htmlhelp_basename = "Package"
extensions = ["autoapi.extension"]
autoapi_dirs = ["package"]
autoapi_file_pattern = "*.py" |
The result is:
Class A | Class B |
---|---|
![]() |
![]() |
Investigations π
It looks like the import matters:
This fails | This works | This works too |
from enum import IntEnum
from .module_B import * |
from .module_B import *
from enum import IntEnum |
from enum import IntEnum
from .module_B import FooB |
I am a bit surprised that this behavior applies even if __all__
is used in both modules.
Origin of the problem
It looks like the function resolve_qualname is the one causing the issue.