diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2025-07-02 14:45:07 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2025-07-02 17:09:25 -0400 |
| commit | dc6b4414bf5b28ca5120319a3cc2bb9bce20739b (patch) | |
| tree | f51220e156d81681f18041937db2fb7cea852c16 /api-docs/source | |
| parent | ce88e8af1f957dc2a48dd2b0a03f64fa057d0f5d (diff) | |
replace autosummary with built-in to fix warnings
Diffstat (limited to 'api-docs/source')
| -rw-r--r-- | api-docs/source/conf.py | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/api-docs/source/conf.py b/api-docs/source/conf.py index 1502c21d..c96acd63 100644 --- a/api-docs/source/conf.py +++ b/api-docs/source/conf.py @@ -148,21 +148,57 @@ Full Class List modulefile.write(f'''{modulename} module {underline} -.. autosummary:: - :toctree: - ''') + + # Generate custom summary table + classes = list(classlist(module)) + if classes: + modulefile.write(".. list-table::\n") + modulefile.write(" :header-rows: 1\n") + modulefile.write(" :widths: 30 70\n\n") + modulefile.write(" * - Class\n") + modulefile.write(" - Description\n") + + for (classname, classref) in classes: + if inspect.isclass(classref): + role = 'py:class' + else: + role = 'py:func' + + # Get docstring summary (first line) + doc = inspect.getdoc(classref) + summary = "" + if doc and doc.strip(): + first_line = doc.split('\n')[0].strip() + # Only use the description if it's actual documentation (not just prototype/signature) + if first_line and not first_line.startswith(classname + "("): + summary = first_line + if len(summary) > 100: + summary = summary[:97] + "..." + + modulefile.write(f" * - :{role}:`{inspect.getmodule(classref).__name__}.{classname}`\n") + modulefile.write(f" - {summary}\n") - for (classname, classref) in classlist(module): - modulefile.write(f" {inspect.getmodule(classref).__name__}.{classname}\n") - - modulefile.write('''\n.. toctree:: - :maxdepth: 2\n''') modulefile.write(f'''\n\n.. automodule:: {module.__name__} :members: :undoc-members: - :show-inheritance:''') + :show-inheritance: + :noindex:\n\n''') + + # Generate individual class sections with proper headers + for (classname, classref) in classes: + # Only include classes that actually belong to this module + if inspect.getmodule(classref).__name__ == module.__name__: + modulefile.write(f'''{classname} +{"-" * len(classname)} + +.. autoclass:: {module.__name__}.{classname} + :members: + :undoc-members: + :show-inheritance: + +''') modulefile.write(stats) modulefile.close() @@ -186,21 +222,24 @@ generaterst() extensions = [ 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', 'sphinx.ext.intersphinx', 'sphinxcontrib.jquery', #'sphinx_tabs.tabs', - 'sphinx.ext.viewcode' + 'sphinx.ext.viewcode', + 'sphinx.ext.autosectionlabel' ] simplify_optional_unions = True autodoc_typehints = 'both' -autosummary_generate = False autodoc_member_order = 'groupwise' +autodoc_class_signature = 'separated' autodoc_type_aliases = { 'int': 'ExpressionIndex' } +# Auto section label configuration +autosectionlabel_prefix_document = True + python_use_unqualified_type_names=True # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] |
