Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

By default, Sphinx uses the values specified in the conf.py file to configure the documentation. However, if you want to modify these settings and use your own configurations, you can pass them directly to the autodoc extension.

To do this, you need to create a separate configuration file (e.g., autodoc_conf.py) where you can override the default configurations. In this file, you can import the values from conf.py and modify or add new ones. For example:

# autodoc_conf.py

# Import the values from conf.py
from conf import *

# Override the default configurations
autodoc_member_order = 'bysource'
autodoc_default_options = {
    'members': True,
    'undoc-members': True,
    'private-members': True,
}

Then, when you run Sphinx, you can specify the autodoc_conf.py file as the configuration file instead of conf.py. For example:

sphinx-build -b html -c /path/to/autodoc_conf.py source_dir build_dir

This will use the configurations specified in autodoc_conf.py instead of conf.py. Note that any settings not overridden in autodoc_conf.py will still use the values defined in conf.py.