From 271a56e9c3d6fc6d52c18c12a518f16dc17057dc Mon Sep 17 00:00:00 2001 From: Alyssa Coghlan Date: Wed, 12 Feb 2025 13:51:16 +1000 Subject: [PATCH] Add `__struct_encode_fields__` to type stub Static type checkers currently complain if querying the encoded field names instead of the attribute names. --- msgspec/__init__.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/msgspec/__init__.pyi b/msgspec/__init__.pyi index 4d2d8744..8011fe1a 100644 --- a/msgspec/__init__.pyi +++ b/msgspec/__init__.pyi @@ -41,6 +41,7 @@ def field(*, name: Optional[str] = None) -> Any: ... @dataclass_transform(field_specifiers=(field,)) class Struct: __struct_fields__: ClassVar[Tuple[str, ...]] + __struct_encode_fields__: ClassVar[Tuple[str, ...]] __struct_config__: ClassVar[structs.StructConfig] __match_args__: ClassVar[Tuple[str, ...]] # A default __init__ so that Structs with unknown field types (say