Open ringohoffman opened 6 days ago
Following https://github.com/mkdocstrings/python/commit/7f9757d1584555edebc56f1aefe6cc8242e6c8bb, other submodules of the package not exported via __all__ are being included in a Modules: section.
__all__
Modules:
e.g. for:
foo/module2.py:
foo/module2.py
from foo import module1 __all__ = [ "Bar", ] class Bar: """Bars the bazes."""
module1 is getting included into a Modules table even though it is not exported.
module1
Modules
https://github.com/ringohoffman/mkdocstrings-python-minimum-reproducible-example/tree/main
git clone https://github.com/ringohoffman/mkdocstrings-python-minimum-reproducible-example cd mkdocstrings-python-minimum-reproducible-example python -m venv .venv . .venv/bin/activate pip install -r requirements.txt mkdocs build mkdocs serve
Then open the doc page for module2.
module2
I only expect the modules to be included in the Modules section if they are exported via __all__.
python -m mkdocstrings_handlers.python.debug # | xclip -selection clipboard - __System__: Linux-5.15.0-117-generic-x86_64-with-glibc2.31 - __Python__: cpython 3.10.15 (/home/matthew/.conda/envs/mkdocstrings/bin/python) - __Environment variables__: - __Installed packages__: - `mkdocs` v1.6.1 - `mkdocstrings` v0.26.2 - `mkdocstrings-python` v1.12.2 - `griffe` v1.5.1
Thanks for the report @ringohoffman, looks like something that can be fixed/improved indeed.
Description of the bug
Following https://github.com/mkdocstrings/python/commit/7f9757d1584555edebc56f1aefe6cc8242e6c8bb, other submodules of the package not exported via
__all__
are being included in aModules:
section.e.g. for:
foo/module2.py
:module1
is getting included into aModules
table even though it is not exported.To Reproduce
https://github.com/ringohoffman/mkdocstrings-python-minimum-reproducible-example/tree/main
Then open the doc page for
module2
.Full traceback
Expected behavior
I only expect the modules to be included in the Modules section if they are exported via
__all__
.Environment information