Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop skipping private fields for attrs classes #803

Open
Tinche opened this issue Jan 20, 2025 · 1 comment
Open

Stop skipping private fields for attrs classes #803

Tinche opened this issue Jan 20, 2025 · 1 comment

Comments

@Tinche
Copy link

Tinche commented Jan 20, 2025

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?

@ipseitas
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants