-
-
Notifications
You must be signed in to change notification settings - Fork 424
Closed
Labels
Description
I read this page on the mypy docs, https://mypy.readthedocs.io/en/stable/additional_features.html which says that you can't simply write a function like this:
def my_dataclass(cls):
return attr.s(cls, auto_attribs=True)
And expect things to type check correctly.
Is there any convenient, mypy compatible way, to change defaults in attrs? I saw the RFC about defaults being inconvenient; better defaults (above all auto_attribs=True) will help but of course people will not necessarily agree on the best defaults, hence why being able to wrap it would be such a win.
It looks like pydantic has done it (https://github.com/samuelcolvin/pydantic/blob/master/pydantic/dataclasses.py), but it's hard for me to separate out the bits that are related to their extra functionality, from the bare minimum.
Reactions are currently unavailable