Skip to content

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

Open
@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

python -m venv .venv
. .venv/bin/activate
pip install mkdocstrings-python
python
# mkdocs.yml
site_name: test-site
plugins:
  - mkdocstrings:
      default_handler: python
      handlers:
        python:
          options:
            separate_signature: true
<!-- test.md -->
::: test
# test.py

class SomeClass:
    """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