Skip to content

Types from attrs.define classes not shown in description #551

@steven-murray

Description

@steven-murray

Say I have an attrs class, e.g.:

import attrs

@attrs.define
class MyClass:
    """
    A class that does something.

    Parameters
    ---------
    a
        The parameter a
    """

    a: float = attrs.field()

Then in my conf.py I have added "sphinx.ext.autodoc" to the extensions list, and set autodoc_typehints = 'description'. I expect that in the generated API docs that the parameter "a" should get the type "float" added to its description, but I don't.

My actual repo (pointing to a PR where Ive added autoapi): 21cmfast/21cmFAST#575
A specific class showing this behaviour: https://github.com/21cmfast/21cmFAST/blob/b0eaa28630f8da31e889fa1badad6892732a4718/src/py21cmfast/wrapper/inputs.py#L1448
The generated docs for this class: https://21cmfast--575.org.readthedocs.build/en/575/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions