A YAML 1.2 loader and dumper for Python that round-trips comments and formatting
open sourceMITfree
ruamel.yaml is a YAML 1.2 loader and dumper for Python. Its default round-trip mode preserves comments, flow and block styles and key order when a file is loaded, changed and written back, which makes it suited to editing configuration files by program. It also has safe and unsafe modes for plain loading, a recursion limit for untrusted input, and optional C extensions. Since 0.18 it has deprecated the old PyYAML-style functions (load, dump and their variants) in favour of its YAML() API.
Problems it solves
- edit a YAML config file from Python without losing comments
- load YAML 1.2 in Python
- update keys in a YAML file while keeping its formatting
Features
- YAML 1.2
- round-trip preservation of comments, styles and key order
- safe loading with a recursion limit
- optional C extensions