UnsignedShort = Annotated[int, struct2.ctype('H')] SignedChar = Annotated[int, struct2.ctype('b')] class Student(struct2.Packed): # mypy typechecks 'name' field as 'str' name: Annotated[str, struct2.ctype("<10s")] serialnum: UnsignedShort school: SignedChar # 'unpack' only uses the metadata within the type annotations Student.unpack(record) # Student(name=b'raymond ', serialnum=4658, school=264)