Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new
msgspec.yaml
submodule for encoding/decoding YAML messages using the type system provided by msgspec. This can be useful for configuration files, or for validating YAML before encoding it in some other format.For example, in a past job I could have used this to load and validate k8s manifests from YAML, before processing and sending them to the k8s server as JSON.
This relies on the third-party PyYAML library for YAML support. A
yaml
extra has been added for providing this dependency.For now only
encode
anddecode
functions have been provided; noEncoder
/Decoder
types. The builtinmsgpack
/json
integration can benefit from reusing those objects, but the overhead of PyYAML and the type conversations makes the use of such types useless beyond interface compatibility. We can add them later if a user need arises.