Skip to content

Add option to collect annotated fields #262

@hynek

Description

@hynek

Since I’m sick of hearing that “PEP 557 is like attrs, but using variable annotations for field declarations”, I’d like to have an option to collect annotated fields that have no attr.ib definition.

ie.

@attr.s(collect_bare=True)
class C:
    x: int

should be equivalent to:

@attr.s
class C:
    x: int = attr.ib()

I’m open to better/shorter names.

Volunteers? @chadrik maybe? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions