Generating of the docs doesn't nest into package
JanPalasek opened this issue · comments
Problem Description
I have a following structure of my python source code:
src/
my_package/
__init__.py
my_module.py
my_sub_package/
__init__.py
Inside my src/my_package/__init__.py
file I do some imports to simplify the API of the package + specify all. For example like this:
from my_module import my_function
from my_sub_package import my_other_function
__all__ = ["my_function", "my_other_function"]
When I run the generating of the documentation with pdoc (python -m pdoc --output-dir out/ --math -d google src/my_package
), the documentation is only generated for file src/my_package/__init__.py
and completely ignores all other files. It does not nest inside the other source code. pdoc
treats the package as a module in such a case.
The solution (for now) is to remove __all__
, but when you create package you often want to use all and other imports to create a specific API.
System Information
pdoc: 14.1.0
Python: 3.10.10
Platform: Linux-4.18.0-425.19.2.el8_7.x86_64-x86_64-with-glibc2.28
This is intended behavior - you need to specify the immediate subpackages in __all__
as well. There isn't really a spec for this, but this is the common convention, see e.g. https://docs.python.org/3/tutorial/modules.html#importing-from-a-package.