-
-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Description
attrs type stubs seem to use a non-standard pyright extension instead of the API described in PEP-681:
Lines 106 to 121 in 4461e2c
| # Static type inference support via __dataclass_transform__ implemented as per: | |
| # https://github.com/microsoft/pyright/blob/1.1.135/specs/dataclass_transforms.md | |
| # This annotation must be applied to all overloads of "define" and "attrs" | |
| # | |
| # NOTE: This is a typing construct and does not exist at runtime. Extensions | |
| # wrapping attrs decorators should declare a separate __dataclass_transform__ | |
| # signature in the extension module using the specification linked above to | |
| # provide pyright support. | |
| def __dataclass_transform__( | |
| *, | |
| eq_default: bool = True, | |
| order_default: bool = False, | |
| kw_only_default: bool = False, | |
| frozen_default: bool = False, | |
| field_descriptors: Tuple[Union[type, Callable[..., Any]], ...] = (()), | |
| ) -> Callable[[_T], _T]: ... |
This makes it difficult for other type checkers and similar tools to consume these type stubs without mirroring the pyright extension.
Would you accept a PR replacing all usages of __dataclass_transform__() with typing.dataclass_transform()? We can use typing_extensions to get dataclass_transform() on Python < 3.11.
Metadata
Metadata
Assignees
Labels
No labels