diff --git a/src/autodoc2/config.py b/src/autodoc2/config.py index b232d57..cc93849 100644 --- a/src/autodoc2/config.py +++ b/src/autodoc2/config.py @@ -488,6 +488,14 @@ class Config: }, ) + db_fixup: t.Callable = dc.field( + default=None, + metadata={ + "help": "Callback to fixup database, e.g. manually set 'all' if __all__ is dynamic", + "category": "render", + }, + ) + # TODO regexes # module_summary: bool | None = None # class_inheritance: bool | None = None diff --git a/src/autodoc2/sphinx/extension.py b/src/autodoc2/sphinx/extension.py index 50ad969..f6add9f 100644 --- a/src/autodoc2/sphinx/extension.py +++ b/src/autodoc2/sphinx/extension.py @@ -197,6 +197,10 @@ def run_autodoc_package(app: Sphinx, config: Config, pkg_index: int) -> str | No def _warn_render(msg: str, type_: WarningSubtypes) -> None: warn_sphinx(msg, type_) + # invoke user-provided fixups + if config.db_fixup: + config.db_fixup(autodoc2_db) + # write the files output.mkdir(parents=True, exist_ok=True) paths = []