sphinx-automodapi icon indicating copy to clipboard operation
sphinx-automodapi copied to clipboard

Support for typing and dataclass fields

Open waszil opened this issue 5 years ago • 1 comments

Hi, great package!

I have one problem: automodapi seems to ignore dataclass fields if they are initialized with the field method or annotated with a typing type:

from dataclasses import dataclass
from typing import Optional, List

@dataclass
class MyClass:
    """description"""
    #: this is ok
    ok: int = 0
    #: this does not get generated
    notok: Optional[int] = None
    #: this does not get generated either
    foo: List[int] = field(default_factory=list)

Is there a solution for this? Thanks!

waszil avatar Sep 23 '20 07:09 waszil

I have created a PR for fixing this: https://github.com/astropy/sphinx-automodapi/pull/116

waszil avatar Sep 23 '20 14:09 waszil