Skip to content

bug: Class init parameter name disappears from attribute docstring using separate_signature#215

@connesy

Description

@connesy

Description of the bug

When calling a method on an input argument to a class __init__ while having separate_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

Details
python -m venv .venv. .venv/bin/activatepip install mkdocstrings-pythonpython
# mkdocs.ymlsite_name: test-siteplugins: - mkdocstrings: default_handler: pythonhandlers: python: options: separate_signature: true
<!-- test.md --> ::: test
# test.pyclassSomeClass: """This is a class that does something."""def__init__(self, some_float: float) ->None: self.as_hex=some_float.hex() """The hex value of the input float."""

Expected behavior

image

I expect the rendered docstring for the as_hex instance attribute to say as_hex = some_float.hex().

Actual behavior

image

With separate_signature: true, the some_float part disappears, and what is rendered is only as_hex = hex().

Environment information

python -m mkdocstrings_handlers.python.debug # | xclip -selection clipboard
  • System: Linux-6.8.0-49-generic-x86_64-with-glibc2.39
  • Python: cpython 3.13.1 (/home/stefan/test-mkdocstrings/.venv/bin/python)
  • Environment variables:
  • Installed packages:
    • mkdocs v1.6.1
    • mkdocstrings v0.27.0
    • mkdocstrings-python v1.12.2
    • griffe v1.5.1

Metadata

Metadata

Assignees

Labels

configRelated to configuration optionsrefactorChange suggestion, not a bug nor a feature.templatesJinja templates

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions