StrictYAML
Published on: 2025-06-28 04:45:51
StrictYAML
StrictYAML is a type-safe YAML parser that parses and validates a restricted subset of the YAML specification.
Priorities:
Beautiful API
Refusing to parse the ugly, hard to read and insecure features of YAML like the Norway problem.
Strict validation of markup and straightforward type casting.
Clear, readable exceptions with code snippets and line numbers .
and . Acting as a near-drop in replacement for pyyaml, ruamel.yaml or poyo.
Ability to read in YAML, make changes and write it out again with comments preserved.
Not speed, currently.
Simple example:
# All about the character name : Ford Prefect age : 42 possessions : - Towel
from strictyaml import load , Map , Str , Int , Seq , YAMLError
Default parse result:
>>> load ( yaml_snippet ) YAML ({ 'name' : 'Ford Prefect' , 'age' : '42' , 'possessions' : [ 'Towel' ]})
All data is string, list or OrderedDict:
>>> load ( yaml_snippet ) . data { 'name' : 'Ford Prefect' , 'age' : '42' , 'possessions' : [ 'Towel' ]}
... Read full article.