Skip to content
uencoder

YAML Python Binding

YAML Python bindings are parsing APIs for Python provided by PyYAML and ruamel.yaml, supporting yaml.safe_load and round-trip editing.

Purpose

To read and write YAML in Python applications, mapping YAML to dict/list, with comment preservation and anchor support.

Mechanism

PyYAML: yaml.safe_load(stream) returns dict/list and yaml.dump(obj) returns a string. ruamel.yaml supports round-trip editing (preserving comments/order/anchors) and YAML 1.2.

Use cases

  • Python configuration files
  • ML hyperparameter configuration
  • Ansible playbooks

Related tools

References