readthedocs / readthedocs/sphinx-autoapi
Wrong namespace resolution for base clases when using star import
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 494
- Forks
- 147
- Avg merge
- 9m
- Merged PRs (30d)
- 1
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 |
|
|
|
|
The result is:
| Class A | Class B |
|---|---|
Investigations π
It looks like the import matters:
| This fails | This works | This works too |
|
|
|
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up β it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the package example with module_A.py, module_B.py, conf.py, and index.rst, comparing the failing star import with the working explicit import. Start with resolve_qualname in autoapi/mappers/python/astroid_utils.py, which the report identifies as the likely source. Done means generated documentation resolves the base class correctly when using the star import and preserves the working cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100