Skip to content

Allow to register new class/dataclass/attribute makers in attrs plugin #5406

Open
@hynek

Description

@hynek

This is a feature request.

attrs is very much intended to be composable (e.g. https://github.com/hynek/environ_config) but currently the attrs plugin only works on the core library's functions:

# The names of the different functions that create classes or arguments.
attr_class_makers = {
'attr.s',
'attr.attrs',
'attr.attributes',
}
attr_dataclass_makers = {
'attr.dataclass',
}
attr_attrib_makers = {
'attr.ib',
'attr.attrib',
'attr.attr',
}

I would like to be able to signal somehow to mypy, that some function is a wrapper around @attr.s/@attr.ib/@attr.dataclass. Not only would third-party applications benefit, but I could really use it while experimenting on python-attrs/attrs#408.

Any ideas/plans how we could achieve that?

cc also @euresti & @chadrik

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions