You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inheritable kw_only for Struct (e.g., kw_only_default=True) #841
Currently, kw_only=True on msgspec.Struct does not inherit to subclasses.
I'm building a pydantic-like wrapper over msgspec, and I want users to define models without repeating kw_only=True:
I tried subclassing StructMeta but failed.
My only working solution is generating a dynamic InnerStruct at runtime, which complicates type handling, nested structures, and serialization.
⸻
Impact
Supporting kw_only_default =True would significantly improve framework and library development on top of msgspec.
Thanks for considering!
Reacted by Apoorv Khandelwal, cswimr, kramar11 and Eneg
changed the title [-]Inheritable `kw_only` for `Struct` (e.g., `kw_always=True`)[/-][+]Inheritable `kw_only` for `Struct` (e.g., `kw_only_default=True`)[/+]on Apr 28, 2025
Activity
[-]Inheritable `kw_only` for `Struct` (e.g., `kw_always=True`)[/-][+]Inheritable `kw_only` for `Struct` (e.g., `kw_only_default=True`)[/+]kent-foodini commentedon Jul 3, 2025
I'd love that option as well. Great library - thanks for the great project.
ofek commentedon Oct 25, 2025
Resolved by #890