Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autosummary ignores __all__ when it is empty #12463

Closed
francois-rozet opened this issue Jun 22, 2024 · 2 comments · Fixed by #13187
Closed

autosummary ignores __all__ when it is empty #12463

francois-rozet opened this issue Jun 22, 2024 · 2 comments · Fixed by #13187

Comments

@francois-rozet
Copy link

Describe the bug

With __all__ = [] in a module, autosummary takes everything as a member instead of nothing, even with autosummary_ignore_module_all = False. In addition, weird members like __builtins__, __file__ and __package__ are showed as members.

"""Dummy module"""

__all__ = []

def component():
    """Dummy component"""

    pass

image

How to Reproduce

I provide a minimal reproducing example in https://github.com/francois-rozet/sphinx-bug

git clone https://github.com/francois-rozet/sphinx-bug
cd sphinx-bug
pip install -e .
pip install sphinx
sphinx-build . html
open html/api/dummy.html

Environment Information

Platform:              linux; (Linux-6.5.0-0.deb12.4-amd64-x86_64-with-glibc2.38)
Python version:        3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:49:32) 
[GCC 12.3.0])
Python implementation: CPython
Sphinx version:        7.3.7
Docutils version:      0.19
Jinja2 version:        3.1.2
Pygments version:      2.17.2

Sphinx extensions

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
]

Additional context

No response

@francois-rozet
Copy link
Author

Note that if dummy/__init__.py is empty

"""Dummy module"""

# __all__ = []

# def component():
#     """Dummy component"""

#     pass

the weird members (__builtins__, __cached__, ...) still appear.

image

@vpratz
Copy link
Contributor

vpratz commented Dec 20, 2024

Thanks for the nice bug report and the repository for reproduction. I could reproduce the bug, the problem was a small check that has gone wrong. I have supplied a fix, maybe one of the maintainers can review it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants