Skip to content

Conversation

machow
Copy link
Owner

@machow machow commented Sep 1, 2023

This PR fixes a bug where setting member_options in options, caused package and dynamic to be set back to their default values on the members

from quartodoc import blueprint, Builder

cfg = yaml.safe_load("""
quartodoc:
  package: quartodoc
  options:
    member_options:
      signature_name: "short"
  sections:
    - contents:
      - MdRenderer
"""

builder = Builder.from_quarto_cfg(cfg)
blueprint(builder)

Caused the error:

WorkaroundKeyError: Cannot find an object named: render_header. Does an object with the path quartodoc:render_header exist?

Since it unset package from quartodoc.MdRenderer, and fell back on the default package quartodoc (in the top-level config).

The gist is that blueprint uses a function called _non_default_entries to get only the arguments manually specified options (since pydantic automatically puts in the defaults, we need a way to get only the ones users manually specified). However, because member_options are nested inside Auto, and we were converting the pydantic Auto to a dict, we accidentally grabbed the defaults too there.

@machow
Copy link
Owner Author

machow commented Sep 1, 2023

cc @hamelsmu may be related to the issue you ran into in #260 (but seems unlikely, would need to see a reproducible example)

@machow machow merged commit 1de0c38 into main Sep 1, 2023
@machow machow deleted the fix-member-options-tracking branch October 12, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant