feat: Prefer stub over target object if not the same kind#422
feat: Prefer stub over target object if not the same kind#422pawamoy merged 2 commits intomkdocstrings:mainfrom
Conversation
|
One possible issue I see is that any modification done by I can deal with the docs update. Could you add back a DEBUG log message informing users that the object is overwritten by its stub equivalent? |
|
Is this acceptable? The previous version had if obj_member.kind is not stub_member.kind:
# If the stub and the target are not of the same kind, prefer the
# stub over the target.
logger.debug(
"In %s, %s source object type != %s stub object type; "
"source object will be overwritten by stub object.",
obj_member.path,
obj_member.name,
stub_member.name,
)
obj.set_member(stub_member.name, stub_member) |
|
Thanks! I think we can shorten it to |
For reviewers
Description of the change
This update changes the behavior of handling stub packages when encountering a target object and stub that are of a different kind.
griffeno longer skips the stub in this case, and instead prefers the stub over the target.Successfully tested on my current documentation project wherein
griffewas seeing aclassobject as amodule-attribute, and with the change, is successfully rendering it as aclasswith the expected docstring from a.pyifile.Both
make checkandmake testare not working for me. If desired, I can provide the failure details. I'm including this to note that neither were run before submitting this PR.Relevant resources
mkdocstringsdiscussion 803: Stubs package configuration for `mkdocstrings` mkdocstrings#803