python-odin/odin

Add a YAML codec

Closed this issue · 4 comments

It's another common format and this library doesn't support it yet.
It should be easy to add. I'll try to do it over the weekend.

Sounds good, YAML was one of the output formats I did have in the back of my mind just never had time to implement it.

All codecs should implement an interface similar to the JSON interface with a load/loads/dump/dumps methods. Also please try to use the built in serializers for formats (eg dates) not supported natively by YAML.

Cheers

I have just committed support for YAML. There is an issue with datetimes (that is actually caused by a bug in pyyaml (http://pyyaml.org/ticket/202). Am looking at alternative solutions. Maybe replace the YAML encoder with Odin's which will store the datetime values as strings that are then parsed by odin.

You can try supporting https://bitbucket.org/ruamel/yaml as well which is a fork of PyYAML that is maintained.

Will have a look, could be a fallback option provided the API has not changed to much.

Would probably prefer making this a separate codec rather than surprise the user with different behaviour depending on what packages you happen to have installed.