pdoc
pdoc copied to clipboard
Warning generated for `__pdoc__[submodule] = False`, but behaviour correct
Expected Behavior
I expect no warnings.
Actual Behavior
<some path>/python3.8/site-packages/pdoc/__init__.py:706: UserWarning: __pdoc__-overriden key 'module' does not exist in module 'mwe'
warn('__pdoc__-overriden key {!r} does not exist '
Steps to Reproduce
mkdir mwe
mkvirtualenv mwe
pip install pdoc3
echo "__pdoc__ = {
'module': False
}
" > mwe/__init__.py
echo '"""Some documentation"""
' > mwe/module.py
pdoc3 --html mwe
Additional info
MarkupSafe-1.1.1mako-1.1.3markdown-3.2.2pdoc3-0.8.1
The issue is we already skip mwe.module when iterating over submodules:
https://github.com/pdoc3/pdoc/blob/1de51a9d7c2f80412d877066f62c57d4100226c7/pdoc/init.py#L655-L656
I guess the warning might try to account for that ...
Hi!
Many thanks for this great tool!
The fix to this issue does not seem to work (i.e. a warning is generated) when the module is a sub-sub-module.
A related question: would it be possible to support the feature where objects/modules can simply set __pdoc__ = False and then they themselves (as well as their members) don't get documented ?
(i.e. a warning is generated) when the module is a sub-sub-module.
Can you show a mwe?
where objects/modules can simply set
__pdoc__ = False
Simply setting:
__pdoc__ = {__name__: False}
# or
class C:
__pdoc__ = {__qualname__: False}
does not work?
Yes, here it is:
"""Contents of package/__init__.py"""
# Two ways to exclude subpack1.
# The 2nd version produces the warning.
# __pdoc__ = {"subpack1": False}
# __pdoc__ = {"package.subpack1": False}
# For subpack2, there is only this way (AFAICT).
# And it produces the warning.
__pdoc__ = {"package.subpack1.subpack2": False}
"""Contents of package.subpack1/__init__.py"""
...
"""Contents of package.subpack1.subpack2/__init__.py"""
# This does not seem to work at all?
__pdoc__ = {__name__: False}