Sphinx AutoAPI#
To use Sphinx AutoAPI with the Ansys Sphinx Theme, you must
add ansys_sphinx_theme.extension.autoapi to the extensions list in your conf.py file
and set the ansys_sphinx_theme_autoapi theme options in the html_theme_options dictionary.
project: The name of the project.output: The path to the directory where the generated files are placed. By default, this is set to theapidirectory.templates: The path to the directory containing the custom templates forsphinx-autoapi. By default, this is set to theautoapi_templatesdirectory in the theme package.directory: The path to the directory containing the source code with respect to theconf.pyfile. By default, this is set to thesrc/ansysdirectory.use_implicit_namespaces: If set toTrue, the autoapi extension use implicit namespaces. By default, this is set toTrue.keep_files: If set toTrue, the autoapi extension keeps the generated files. By default, this is set toTrue.own_page_level: The level of the page where the autoapi extension places the content of the class. By default, this is set toclass.type: The type of the autoapi extension. By default, this is set topython.options: The options to pass to the autoapi extension. By default, this is set to["members", "undoc-members", "show-inheritance", "show-module-summary", "special-members"].class_content: The content of the class. By default this is set toclass.ignore: The list of directories to ignore. By default, this is empty.add_toctree_entry: If set toTrue, the autoapi extension adds the generated files to the TOC tree. By default, this is set toFalse.package_depth: The depth of the package. By default, this is set to3. This is thenamespacedepth of the package. For example, if the package isansys, the depth is1. If the package isansys.foo, the depth is2.member_order: The order to document members. By default, this is set tobysource. Other options includealphabetical, which orders members by their name (case sensitive), orgroupwise, which orders members by their type and alphabetically.
All these options can be set in the conf.py file of your Sphinx project.
html_theme_options = {
"ansys_sphinx_theme_autoapi": {
"project": "My Project",
"output": "api",
"directory": "src/ansys",
"use_implicit_namespaces": True,
"keep_files": True,
"own_page_level": "class",
"type": "python",
"options": [
"members",
"undoc-members",
"show-inheritance",
"show-module-summary",
"special-members",
],
"class_content": "class",
"ignore": [],
"add_toctree_entry": False,
"package_depth": 3,
"member_order": "bysource",
}
}
You need to add ansys_sphinx_theme.extension.autoapi to the extensions list in your conf.py file:
extensions = [
"ansys_sphinx_theme.extension.autoapi",
]
The complete configuration for sphinx-autoapi in your conf.py file should look like this:
html_theme_options = {
"ansys_sphinx_theme_autoapi": {
"project": "My Project",
"output": "api",
"use_implicit_namespaces": True,
"directory": "src/ansys",
"keep_files": True,
"own_page_level": "class",
"type": "python",
"options": [
"members",
"undoc-members",
"show-inheritance",
"show-module-summary",
"special-members",
],
"class_content": "class",
}
}
extensions = [
"ansys_sphinx_theme.extension.autoapi",
]