Documentation for instance variables without docstrings
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
I'm a bit surprised that instance variables aren't automatically picked up if they don't have docstrings. Property methods without docstrings are listed, I'd expect regular instance variables to show up as well.
Expected Behavior
class Test:
one: str
two: str
def __init__(self, value: str) -> None:
self.one = value
"""one docstring."""
self.two = value
@property
def foo(self) -> str:
return self.value
def bar(self) -> int:
pass
should become:
Classes
-------
`Test(value: str)`
:
### Instance variables
`foo`
:
`one`
: one docstring.
`two`
:
### Methods
`bar(self) -> int`
:
(I actually expect the types to show as well for all three instance variables, but that's covered in #121.)
Actual Behavior
Classes
-------
`Test(value: str)`
:
### Instance variables
`foo`
:
`one`
: one docstring.
### Methods
`bar(self) -> int`
:
Steps to Reproduce
See sample code above.
Additional info
- pdoc version: 0.7.4
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 sample Test class and compare the generated documentation with the expected output. Trace how pdoc discovers instance variables and update that behavior so undocumented variables such as two are listed, then verify the output against the example and preserve the existing one docstring and property entries.
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
- Clearly specified
- Newbie friendliness
- 45/100