pdoc3 / pdoc3/pdoc

Documentation for instance variables without docstrings

Open
#154 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.