简体   繁体   中英

Group method docstrings in sphinx

Is it possible to group several method docstrings with sphinx using it's autodoc capabilities, so that they are listed together?

class Test(object):
    def a(self):
        """A method of group foo."""

    def b(self):
        """A method of group bar."""

    def c(self):
        """A method of group bar."""

    def d(self):
        """A method of group foo."""

In the generated documentation a and d should be listed together, aswell as b and c.

Group the methods in the source module and configure Sphinx to output them in that order, using autodoc_member_order = 'bysource' .

I am not aware of any other way to group members.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM