Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
loads
✓ from yaml_rs import loads
✗ import yaml_rs
yaml_rs.loads(yaml)
Not wrong functionally, but direct import is idiomatic.
dumps
✓ from yaml_rs import dumps
YAMLDecodeError
✓ from yaml_rs import YAMLDecodeError
✗ yaml_rs.YAMLDecodeError
Works but direct import is cleaner.
DuplicateKeyPolicy
✓ from yaml_rs import DuplicateKeyPolicy
Quick example of dumping and loading YAML with yaml-rs.
from yaml_rs import loads, dumps
data = {"name": "yaml-rs", "version": [0, 1, 0]}
yaml_str = dumps(data)
print(yaml_str)
# 'name: yaml-rs\nversion: [0, 1, 0]\n'
parsed = loads(yaml_str)
print(parsed)
# {'name': 'yaml-rs', 'version': [0, 1, 0]}
Debug
Known issues
breakingIn version 0.1.0, the default DuplicateKeyPolicy changed from 'LastWins' to 'Error'. Parsing YAML with duplicate keys will now raise YAMLDecodeError instead of silently using the last value.fixTo preserve old behavior, pass DuplicateKeyPolicy.LastWins: loads(yaml_str, duplicate_key_policy=DuplicateKeyPolicy.LastWins)
affects: >=0.1.0
gotchayaml-rs does not support all YAML 1.2 features. It is based on the saphyr crate which targets YAML 1.1. Some edge cases may parse differently than PyYAML.fixTest your YAML data thoroughly. Use strict YAML 1.1 compliant documents.
affects: all
deprecatedNo deprecations known at this time.
Errors
Common errors & fixes
yaml_rs.YAMLDecodeError: Duplicate key found: x
Default behavior in 0.1.0+ is to error on duplicate keys. Previous versions allowed overwriting.
fixUse DuplicateKeyPolicy.LastWins: loads(yaml, duplicate_key_policy=DuplicateKeyPolicy.LastWins)
ModuleNotFoundError: No module named 'yaml_rs'
Package not installed or wrong Python environment.
fixRun `pip install yaml-rs` and ensure you're using the correct interpreter (Python >=3.10).
Upgrade
Version history
0.1.0latest on PyPI · released Apr 21, 2026
Audit
Dependencies
No dependency data recorded yet.