-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Support ruamel.yaml as a yaml decoder/encoder #15
Comments
Although, right after I open this, I realize |
I've looked into ruamel.yaml and I definitely appreciate the fact that upstream PyYAML is on life support/nearly dead. Map ordering is preserved by both yq and jq. As you correctly point out, preservation of comments is irrelevant since JSON does not admit comments and jq does not support non-standard JSON dialects that do. The main reason to use ruamel.yaml is actually its support for YAML 1.2, which PyYAML does not support and which eliminates some annoying unused misfeatures like "sexagesimals" that interfere with reasonable YAML use cases. With that said, I am not yet comfortable switching to ruamel.yaml because I don't consider that project to be sufficiently mature. The ideal situation would be if the key features introduced by ruamel.yaml were ported to and released in PyYAML by its new maintainers. |
I didn't realize jq was preserving the map ordering, which makes me quite happy to learn. I figured it might depend, but the output had been what I was mostly hoping for, in either case, yq does most of what I want, so I'm pretty happy with what it's currently doing. Agreed on the point that it would be nice for the various python yaml libraries to try and consolidate though. |
ruamel.yaml increases to drift away from (ahead of) PyYAML in many ways. Many Python projects which are emitting yaml as a human readable config are switching to ruamel.yaml in order to have stable yaml files. I suggest this is re-opened and a new flag like |
https://bitbucket.org/ruamel/yaml is the link to the package's source code repo, it's ruamel.yaml on pypi.
ruamel.yaml is really nice because it can preserve original formatting, meaning comments, and ordering of maps, etc is preserved. If
yq
could support this as an optional dependency and flag that allows controlling usage, that would be great. I'd even potentially look into implementing it if it doesn't seem too hard.The text was updated successfully, but these errors were encountered: