pdoc icon indicating copy to clipboard operation
pdoc copied to clipboard

Documentation for instance variables without docstrings

Open plinss opened this issue 5 years ago • 1 comments

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

plinss avatar Feb 03 '20 02:02 plinss

I expected the same result. Has this feature been added or is this not possible? Truthfully, I don't understand why they shouldn't be listed, @kernc is there a specific reason for this?

KSneijders avatar Jun 11 '21 22:06 KSneijders