Title: bug: Class init parameter name disappears from attribute docstring using `separate_signature` · Issue #215 · mkdocstrings/python · GitHub
Open Graph Title: bug: Class init parameter name disappears from attribute docstring using `separate_signature` · Issue #215 · mkdocstrings/python
X Title: bug: Class init parameter name disappears from attribute docstring using `separate_signature` · Issue #215 · mkdocstrings/python
Description: 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 an...
Open Graph Description: 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 docst...
X Description: 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 docst...
Opengraph URL: https://github.com/mkdocstrings/python/issues/215
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: Class init parameter name disappears from attribute docstring using `separate_signature`","articleBody":"### Description of the bug\r\nWhen 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.\r\n\r\n### To Reproduce\r\n\u003cdetails\u003e\r\n\r\n```console\r\npython -m venv .venv\r\n. .venv/bin/activate\r\npip install mkdocstrings-python\r\npython\r\n```\r\n\r\n```yaml\r\n# mkdocs.yml\r\nsite_name: test-site\r\nplugins:\r\n - mkdocstrings:\r\n default_handler: python\r\n handlers:\r\n python:\r\n options:\r\n separate_signature: true\r\n```\r\n\r\n```markdown\r\n\u003c!-- test.md --\u003e\r\n::: test\r\n```\r\n\r\n```python\r\n# test.py\r\n\r\nclass SomeClass:\r\n \"\"\"This is a class that does something.\"\"\"\r\n\r\n def __init__(self, some_float: float) -\u003e None:\r\n self.as_hex = some_float.hex()\r\n \"\"\"The hex value of the input float.\"\"\"\r\n```\r\n\u003c/details\u003e\r\n\r\n### Expected behavior\r\n\r\n\r\nI expect the rendered docstring for the `as_hex` instance attribute to say `as_hex = some_float.hex()`.\r\n\r\n### Actual behavior\r\n\r\n\r\nWith `separate_signature: true`, the `some_float` part disappears, and what is rendered is only `as_hex = hex()`.\r\n\r\n\r\n### Environment information\r\n```bash\r\npython -m mkdocstrings_handlers.python.debug # | xclip -selection clipboard\r\n```\r\n\r\n- __System__: Linux-6.8.0-49-generic-x86_64-with-glibc2.39\r\n- __Python__: cpython 3.13.1 (/home/stefan/test-mkdocstrings/.venv/bin/python)\r\n- __Environment variables__:\r\n- __Installed packages__:\r\n - `mkdocs` v1.6.1\r\n - `mkdocstrings` v0.27.0\r\n - `mkdocstrings-python` v1.12.2\r\n - `griffe` v1.5.1","author":{"url":"https://github.com/connesy","@type":"Person","name":"connesy"},"datePublished":"2024-12-11T13:45:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/215/python/issues/215"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d802898d-5309-b26d-4599-1236be0828e8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ACD0:3D10A9:160B0F:1D6634:696E6C6E |
| html-safe-nonce | 8694aaa6e852efb5b6362c00ca6588e99ff407b18d25849cfc421e195b54af21 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0QwOjNEMTBBOToxNjBCMEY6MUQ2NjM0OjY5NkU2QzZFIiwidmlzaXRvcl9pZCI6Ijc2NTE0MzM2MzYyODgxNjI5MjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7723bfba815f293070fe2b614c322a55d792b6bb367a0d8371d1ddd64cf30dec |
| hovercard-subject-tag | issue:2733025198 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/mkdocstrings/python/215/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ac9d1242a5fb19636e127f26338d88544a000281d4828f14f8091fdf2013b529/mkdocstrings/python/issues/215 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ac9d1242a5fb19636e127f26338d88544a000281d4828f14f8091fdf2013b529/mkdocstrings/python/issues/215 |
| og:image:alt | 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 docst... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | connesy |
| hostname | github.com |
| expected-hostname | github.com |
| None | dd24262d9e4947a6c63df018b01e9a6da49caaf8259148a56a04b665d15d66b3 |
| turbo-cache-control | no-preview |
| go-import | github.com/mkdocstrings/python git https://github.com/mkdocstrings/python.git |
| octolytics-dimension-user_id | 75664361 |
| octolytics-dimension-user_login | mkdocstrings |
| octolytics-dimension-repository_id | 422878404 |
| octolytics-dimension-repository_nwo | mkdocstrings/python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 422878404 |
| octolytics-dimension-repository_network_root_nwo | mkdocstrings/python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 307ab96ec5f21762ff6c530a60b1ef6b1e74dd5a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width