Search code examples
python-sphinxprivate-membersautodoc

Sphinx Autodoc output order


Is it possible to change the order of the output generated with Sphinx AutoDoc?

In particular, I am including private members, using the :private-members: directive. What I want is the private members to appear last in the output and not first which is the default, caused by alphabetic order and the "_" character coming before "A".


Solution

  • Just as @Steve Piercy mentioned, you can set the order using the config value autodoc_member_order. To get the desired behaviour, just add autodoc_member_order = 'bysource' to your conf.py. This will make your documentations order the same as your source order.