pdoc3 / pdoc3/pdoc

classmethods documented as a static method

Open
#126 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted 🤷
Dominant language
Python
Stars
1.2k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

Expected Behavior

image

Actual Behavior

image

Steps to Reproduce

Example code:

import documentation_test.submod1.submod1 as submod1
import documentation_test.submod2.submod2 as submod2

__all__ = ['testFunction', 'testClass']


class testClass(object):

    """Summary of class

    Attributes
    ----------
    arg : str
        a string to print
    """

    def __init__(self, arg: str):
        """Summary of init

        Parameters
        ----------
        arg : str, optional
            a string to print
        """
        super(testClass, self).__init__()
        self.arg = arg

    @classmethod
    def createString(cls, aString: str):
        """create a string

        Parameters
        ----------
        aString : str
            a string to print
        """
        return cls(arg=aString)

    def printString(self):
        """Print a string
        """
        print(self.arg)


def testFunction(anything: str = 'test') -> None:
    """test function for a demo import of whole module

    Parameters
    ----------
    anything : str, optional
        a test string

    Returns
    -------
    None
    """
    print(anything)


submod1.submod1('string from submod1 in base')

submod2.submod2('string from submod2 in base')

Command ran: pdoc --config show_type_annotations=True --html src/documentation_test --force

Additional info
  • pdoc version: 0.7.2
  • python 3.8

Not sure if this is intentional or I have done something nonstandard. No matter what I try; class in a submodule, class with both static and class methods, etc. I get the same result.

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

Reproduce the output with the example package under src/documentation_test using pdoc --config show_type_annotations=True --html src/documentation_test --force. Compare how the generated documentation labels createString with the expected and actual results, then trace the relevant class-member handling. Done means classmethods are documented as class methods rather than static methods, with regression coverage for the example.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.