Python – How NOT to sort Sphinx output in alphabetical order

Question:

With Sphinx for Python how is it possible to avoid having all the method/function names sorted alphabetically in HTML?
I want to keep them in the very same order as they are found in the source code.

Asked By: Alex Poca

||

Answers:

From the sphinx.ext.autodoc documentation:

autodoc_member_order

This value selects if automatically documented members are sorted alphabetical (value ‘alphabetical’), by member type (value ‘groupwise’) or by source order (value ‘bysource’). The default is alphabetical.

Note that for source order, the module must be a Python module with the source code available.

So somewhere in your conf.py file, put:

autodoc_member_order = 'bysource'
Answered By: James Scholes

For a single .rst file (watch the last string):

foo.bar module
=========================

.. automodule:: foo.bar
   :members:
   :undoc-members:
   :show-inheritance:
   :member-order: bysource
Answered By: banderlog013
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.