{"id":28473,"library":"yaml-rs","title":"yaml-rs","description":"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.","status":"active","version":"0.1.0","language":"python","source_language":"en","source_url":"https://github.com/lava-sh/yaml-rs","tags":["yaml","parser","rust","high-performance","serde"],"install":[{"cmd":"pip install yaml-rs","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Not wrong functionally, but direct import is idiomatic.","wrong":"import yaml_rs\n yaml_rs.loads(yaml)","symbol":"loads","correct":"from yaml_rs import loads"},{"note":"","wrong":"","symbol":"dumps","correct":"from yaml_rs import dumps"},{"note":"Works but direct import is cleaner.","wrong":"yaml_rs.YAMLDecodeError","symbol":"YAMLDecodeError","correct":"from yaml_rs import YAMLDecodeError"},{"note":"","wrong":"","symbol":"DuplicateKeyPolicy","correct":"from yaml_rs import DuplicateKeyPolicy"}],"quickstart":{"code":"from yaml_rs import loads, dumps\n\ndata = {\"name\": \"yaml-rs\", \"version\": [0, 1, 0]}\nyaml_str = dumps(data)\nprint(yaml_str)\n# 'name: yaml-rs\\nversion: [0, 1, 0]\\n'\n\nparsed = loads(yaml_str)\nprint(parsed)\n# {'name': 'yaml-rs', 'version': [0, 1, 0]}","lang":"python","description":"Quick example of dumping and loading YAML with yaml-rs."},"warnings":[{"fix":"To preserve old behavior, pass DuplicateKeyPolicy.LastWins: loads(yaml_str, duplicate_key_policy=DuplicateKeyPolicy.LastWins)","message":"In 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.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Test your YAML data thoroughly. Use strict YAML 1.1 compliant documents.","message":"yaml-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.","severity":"gotcha","affected_versions":"all"},{"fix":"","message":"No deprecations known at this time.","severity":"deprecated","affected_versions":""}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use DuplicateKeyPolicy.LastWins: loads(yaml, duplicate_key_policy=DuplicateKeyPolicy.LastWins)","cause":"Default behavior in 0.1.0+ is to error on duplicate keys. Previous versions allowed overwriting.","error":"yaml_rs.YAMLDecodeError: Duplicate key found: x"},{"fix":"Run `pip install yaml-rs` and ensure you're using the correct interpreter (Python >=3.10).","cause":"Package not installed or wrong Python environment.","error":"ModuleNotFoundError: No module named 'yaml_rs'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}