Python - how to NOT sort Sphinx output alphabetically

With Sphinx for Python, how can I avoid having all method / function names sorted alphabetically in HTML? I want to keep them in the same order as in the source code.

+7
python python-sphinx
source share
1 answer

From the sphinx.ext.autodoc documentation :

autodoc_member_order

This value is selected if automatically documented members are sorted alphabetically (value "alphabetically"), by member type (value "groupwise"), or by source order (value "bysource"). The default value is in alphabetical order.

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

So, somewhere in your conf.py file, put:

autodoc_member_order = 'bysource' 
+13
source share

All Articles