-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Closed
Copy link
Milestone
Description
Describe the bug
I am not sure if this is a bug or I am doing something wrong :)
But when I have the code below, the docstring of initialize won't appear in my doc html.
Surprisingly, the initialize method will appear in the docs when I remove the __call__ method from the class.
To Reproduce
from types import SimpleNamespace
from typing import Any
class Container:
pass
class Initializer:
def __call__(self, container_name: str, initial_content: Any = SimpleNamespace()):
setattr(Container, container_name, initial_content)
def __getattr__(self, container_name: str):
return lambda initial_content = SimpleNamespace(): setattr(_Container, container_name, initial_content)
initialize = Initializer()
initialize.__doc__ = """
This is some documentation.
"""cd docs && \
make clean && \
sphinx-apidoc --force -e -o ./source ../<package> && \
make htmlExpected behavior
Docs of initialize should appear in the docs but they do not.
Environment info
Python version: [3.8.5]
Sphinx==3.4.3
sphinx-rtd-theme==0.5.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
extensions = ['sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon']