msgspec
msgspec copied to clipboard
Stop skipping private fields for attrs classes
Description
Continuing our discussion from Bluesky, I would really like for msgspec to stop skipping fields prefixed with _ for attrs classes. This would make attrs classes consistent with dataclasses, and more importantly - enable handling APIs that require field names that start with underscores, which I find to not be super common, but definitely an important use case.
If this is simple, maybe I could contribute this?
You can use field to define a custom name mapping between the underscore-prefixed API keys and Struct attributes:
https://jcristharif.com/msgspec/api.html#msgspec.field