sphinx-doc / sphinx-doc/sphinx
Autodoc: Method signature from docstring does not work for methods with no additonal arguments
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Method signatures are not inferred from docstring, if no arguments are given.
Problem
I have a bunch of types created using C-extensions. I would like to include their function signature using the autodoc_docstring_signature option. For most methods, this works correctly. However, for functions accepting no additional arguments (other than self), the signature is simply
"""
some_method()
The description begins here.
...
"""
which renders as
some_method
instead of the expected
some_method()
This problem does only occur in methods from C-extensions, methods in normal Python classes are rendered correctly.
Reproducible project / your project
https://github.com/padix-key/biotite branch doc
For example in the type biotite.structure.BondList in the method as_array()
Environment info
- OS: Xubuntu 18.04
- Python version: 3.6
- Sphinx version: 1.7.8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the autodoc_docstring_signature handling and reproduce the issue using biotite.structure.BondList.as_array() from the linked project. The work is complete when a C-extension method documented as some_method() renders with the parentheses instead of only some_method.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100