I'm trying to .. autoclass::
a class with instance attribute:
.. autoclass:: synergine.core.Test.Test
:members:
:undoc-members:
:private-members:
of (in file synergine/core/Test.py):
class Test:
def __init__(self):
#: A foo bar instance attribute !
self._foo = 'bar'
But when i make html
sphinx raise this error:
/home/bux/Projets/synergine/doc/source/Components.rst:143: WARNING: autodoc: failed to import attribute 'Test._foo' from module 'synergine.core.Test'; the following exception was raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/sphinx/util/inspect.py", line 108, in safe_getattr
return getattr(obj, name, *defargs)
AttributeError: type object 'Test' has no attribute '_foo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/sphinx/ext/autodoc.py", line 342, in import_object
obj = self.get_attr(obj, part)
File "/usr/local/lib/python3.4/dist-packages/sphinx/ext/autodoc.py", line 241, in get_attr
return safe_getattr(obj, name, *defargs)
File "/usr/local/lib/python3.4/dist-packages/sphinx/util/inspect.py", line 114, in safe_getattr
raise AttributeError(name)
AttributeError: _foo
Why ? What i've to do to document this instance attribute ?
Edit: Seems to be bug reported: https://github.com/sphinx-doc/sphinx/issues/956 . Any way to hack it ?