diff --git a/quartodoc/autosummary.py b/quartodoc/autosummary.py index c6bea4e..94b0dfc 100644 --- a/quartodoc/autosummary.py +++ b/quartodoc/autosummary.py @@ -444,7 +444,8 @@ class Builder: parser: Docstring parser to use. This correspond to different docstring styles, and can be one of "google", "sphinx", and "numpy". Defaults to "numpy". - + kwargs: + Additional options are ignored with a warning for forwards compatibility. """ # builder dispatching ---- @@ -495,6 +496,7 @@ def __init__( parser="numpy", render_interlinks: bool = False, _fast_inventory=False, + **kwargs: Any ): self.layout = self.load_layout( sections=sections, package=package, options=options @@ -508,6 +510,15 @@ def __init__( self.css = css self.parser = parser + if len(kwargs) > 0: + ignored_keys = [f"'{k}'" for k in kwargs.keys()] + text_options = "option" if len(kwargs) == 1 else "options" + raise ValueError( + f"Unknown quartodoc {text_options}: {', '.join(ignored_keys)}. " + "Please see " + "for quartodoc site configuration options." + ) + self.renderer = Renderer.from_config(renderer) if render_interlinks: # this is a top-level option, but lives on the renderer diff --git a/quartodoc/tests/test_builder.py b/quartodoc/tests/test_builder.py index 932bc97..27f8dc6 100644 --- a/quartodoc/tests/test_builder.py +++ b/quartodoc/tests/test_builder.py @@ -58,6 +58,22 @@ def test_builder_auto_options(): builder = Builder.from_quarto_config(cfg) assert builder.layout.options.members == ["a_func", "a_attr"] +def test_builder_error_unknown_options(): + cfg = yaml.safe_load( + """ + quartodoc: + package: quartodoc + this_is_not_a_real_option: true + options: + members: [a_func, a_attr] + sections: + - contents: [quartodoc.tests.example] + """ + ) + + with pytest.raises(ValueError): + Builder.from_quarto_config(cfg) + def test_builder_generate_sidebar(tmp_path, snapshot): cfg = yaml.safe_load(