Registry / serialization / yaml-rs

yaml-rs

JSON →
library0.1.0pypypi✓ verified 84d ago

A high-performance YAML parser for Python written in Rust. Current version 0.1.0. Uses the saphyr YAML library under the hood. Provides loads/dumps with a DuplicateKeyPolicy enum (default Error). Active development, weekly releases.

pip install yaml-rs
INSTALL
IMPORT
SIG · YAML-RS
Y
yaml-rs
serializationpythonv0.1.0
harness data pending
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.
fix
To 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.
fix
Test 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.
fix
Use DuplicateKeyPolicy.LastWins: loads(yaml, duplicate_key_policy=DuplicateKeyPolicy.LastWins)
ModuleNotFoundError: No module named 'yaml_rs'
Package not installed or wrong Python environment.
fix
Run `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.

Agent activity
37 hits · last 30 days
node
30
OpenAI (training)
1
Resources
yaml-rs — pip install yaml-rs · libregistry