Skip to content

Fine grain config #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Fine grain config #289

wants to merge 2 commits into from

Conversation

pawamoy
Copy link
Member

@pawamoy pawamoy commented Jul 2, 2025

No description provided.

pawamoy added 2 commits June 3, 2025 15:41
This change allows users to specify recursive options under `members`:

```
::: some.module
    options:
      members:
      - name: SomeName
        options:
          heading: Some Verbose Name
          members:
          - ...
```

This change also brings a refactor in how we combine default, global and
local configuration. Instead of keeping track of dictionaries to merge
them accordingly, we now chain dataclasses together, using a special
`UNSET` value to tell whether an option was set or not. Checking against
this `UNSET` value lets the chained dataclass know whether it should
try to fetch the value from previous (left/up) dataclasses.

With the following example chain:

```
{ some_option: UNSET } -> { some_option: False } -> { some_option: UNSET
}
```

...trying to get `some_option` from the chain would start with the
right-most dataclass, where `some_option` is `UNSET`. Then it would
continue on the left, and return `False` since it's not `UNSET`. The
left-most dataclass would not be checked since the value was already
returned.

This change lets us simplify templates, as we don't have to check if
we're rendering the root object anymore: the configuration options are
chained in a way that prevent options that are only relevant to the root
object to be propagated further down to members.

Issue-658: mkdocstrings/mkdocstrings#658
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