-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
bug: Class init parameter name disappears from attribute docstring using separate_signature
#215
Comments
Thanks for the report @connesy. This behavior is configurable with this setting: https://mkdocstrings.github.io/python/usage/configuration/signatures/#annotations_path. Note though that we already have one special case, for enumeration values: Or maybe attribute values should never be shortened! Or configured with a different setting than |
Yes, there's a reproducible example in the details of my issue. |
I would think this would be a different setting (if it existed) than
I would not expect attribute values to be shortened (more than what is in the source document). If my |
Yeah, I agree that would be more sensible. And that would even allow us to get rid of the special casing for enum values. |
I guess it could follow the value of import module.submodule
class SomeClass:
def __init__(self, value: module.submodule.SomeType):
self.parsed_value = module.submodule.module_instance.method(value) In this case, the type annotation will be shortened (or not) based on |
So basically removing all parts that are modules. I can imagine a few edge cases where users would still want to show the module parts because otherwise the rest would be ambiguous (several different modules providing a function with the same name for example). The safest bet here is to render what's in the source. Any other "smart" shortening would feel a bit arbitrary IMO. I'll review existing docs to see how this setting is used, and how it affects attributes rendering, and whether we can easily change it without breaking use-cases. |
Description of the bug
When calling a method on an input argument to a class
__init__
while havingseparate_signature: true
, the parameter name disappears from the rendered instance attribute docstring, leaving only the attribute name and the method called on the input argument.To Reproduce
<!-- test.md --> ::: test
Expected behavior
I expect the rendered docstring for the
as_hex
instance attribute to sayas_hex = some_float.hex()
.Actual behavior
With
separate_signature: true
, thesome_float
part disappears, and what is rendered is onlyas_hex = hex()
.Environment information
python -m mkdocstrings_handlers.python.debug # | xclip -selection clipboard
mkdocs
v1.6.1mkdocstrings
v0.27.0mkdocstrings-python
v1.12.2griffe
v1.5.1The text was updated successfully, but these errors were encountered: