Skip to content

Cover conversion to/from builtins in usage docs#780

Open
ncoghlan wants to merge 3 commits into
msgspec:mainfrom
ncoghlan:convert-to-builtins-usage-docs
Open

Cover conversion to/from builtins in usage docs#780
ncoghlan wants to merge 3 commits into
msgspec:mainfrom
ncoghlan:convert-to-builtins-usage-docs

Conversation

@ncoghlan

@ncoghlan ncoghlan commented Dec 5, 2024

Copy link
Copy Markdown

Also clarify differences between to_builtins and asdict.

Closes #778

Also clarify differences between `to_builtins` and `asdict`.

Closes msgspec#778
@ncoghlan

Copy link
Copy Markdown
Author

Likely worth linking to https://github.com/jcrist/msgspec/blob/main/docs/source/converters.rst from the new subsection, since that goes into more detail on how to_builtins and convert relate to each other.

Siyet added a commit that referenced this pull request May 26, 2026
…1025)

Add a usage docs section explaining that to_builtins is the encoding half (respects omit_defaults, UNSET, recurses into nested struct-like types, applies value-level conversions) while structs.asdict/astuple perform a one-to-one conversion following the dataclasses.asdict/astuple contract.

Cross-reference the new section from the omit_defaults and UNSET sections, and update the C docstrings for asdict, astuple, and to_builtins.

Fixes #778. Supersedes #780.
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

Successfully merging this pull request may close these issues.

Cover omit_defaults handling in asdict and to_builtins documentation

1 participant