I have a bunch of classes which use \"special-methods\":
class Foo(object):
\"Foo docstring\"
attr1 = \"Attribute!\" #: first attribute
attr2 = \"Anoth
I'm currently not 100% thrilled with this solution, so I hope someone can come along an improve it. However, the way I've solved this problem is to do the following:
.. automodule:: myproject.foomodule
:members:
:undoc-members:
:show-inheritance:
.. autoclass:: myproject.foomodule.Foo
:exclude-members: attr1,attr2
.. autoattribute:: myproject.foomodule.Foo.attr1
.. autoattribute:: myproject.foomodule.Foo.attr2
.. automethod:: myproject.foomodule.Foo.__contains__
Here I actually need to tell autodoc
to avoid documenting the class attributes (automatically) and then I need to add them back on explicitly. The reason is because apparently when you explicitly nest commands, the explicit ones come first. If I only explicitly say to add __contains__
, then it shows up before the attributes which I didn't like.