Skip to content

pdoc3 skips a decorated function (callable object) #221

Open
@ShuhuaGao

Description

@ShuhuaGao

Expected Behavior

Generate the documentation for add3

Actual Behavior

Nothing is generated

Steps to Reproduce

  1. Create a script "pdoc_tt.py" as follows
from numba import cuda


@cuda.jit
def add3(a: int, b: int) -> int:
    """Add two integers

    Args:
        a (int): one integer
        b (int): the other integer

    Returns:
        int: the sum
    """
    return a + b


# add3 is a callable object of type 'numba.cuda.compiler.AutoJitCUDAKernel`
# set the two attributes below manually, since `AutoJitCUDAKernel` does not preserve them
add3.__module__ = __name__
add3.__doc__ = add3.py_func.__doc__  # the right hand  side is just the original __doc__

print(callable(add3))
print(add3.__module__)
print(add3.__doc__)

The package numba is found here

  1. run command pdoc3 --html pdoc_tt.py
  2. We see the following output in the terminal
True
pdoc_tt
Add two integers

    Args:
        a (int): one integer
        b (int): the other integer

    Returns:
        int: the sum

As we see, add3 is indeed callable, and its __module__ and __doc__ are also right. However, there is no documentation generated for add3 in the Html "pdoc_tt.html".

Additional info

Adding __pdoc__ = {'add3': True} makes no difference.

  • pdoc version: pdoc.exe 0.8.1 (on Windows 10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions