User guide¶
Loaded mappings and sequences work like Python dictionaries and lists, with the file's formatting kept alongside them, and registered classes load as their own objects. Start with reading and writing YAML if you have not used yamluna before.
Common tasks¶
| I want to… | Guide |
|---|---|
| Save and load my own classes | Custom classes |
Store types I do not own, such as ndarray or Decimal |
Custom classes |
| Update a string, file, or multi-document stream | Read and write YAML |
| Add comments or move entries with their comments | Comments |
| Keep quotes or write multiline text | Strings and numbers |
| Use shared values and defaults | Anchors and merges |
| Choose indentation or document markers | Settings |
| Report invalid YAML | Handle errors |
| Copy a practical recipe | Examples |
| Check current edge cases | Known limitations |
Choosing and switching¶
- Why yamluna: what it does differently, with examples.
- Compare libraries: yamluna, PyYAML, ruamel.yaml, py-yaml12, and StrictYAML, with features, round-trip results, and speed.
- Switch to yamluna: the code changes to make, with guides from PyYAML, from ruamel.yaml, and from py-yaml12 or StrictYAML.
For method signatures, use the API reference.