On this page
parse-yaml
Prev: parse-xml1 | Up: projects | Next: parse-toml
Rel: wispsy, Foundation, parse-toml, parse-xml1
Ref: wispsy on GitHub
Tags: #public #wispsy #project #foundation #tier/standard
Role
Bounded YAML 1.2 core-schema subset parser for Python 3.14+ (0.1.0, zero runtime deps)—returning a typed Document (document.value, document.to_yaml(), source span) or value-only loads(), rejecting duplicate keys and unsupported constructs with ParseError line/column diagnostics.
Install
python -m pip install parse-yaml
Quickstart
from parse_yaml import parse
document = parse("""
name: Ada
active: true
roles:
- admin
- editor
""")
assert document.value == {
"name": "Ada",
"active": True,
"roles": ["admin", "editor"],
}
assert document.to_yaml().startswith("\nname: Ada")
When to Reach for It
- Parsing YAML 1.2 block/flow mappings, sequences, and core scalars (e.g., config files or vault metadata blocks) with explicit bounds and zero third-party YAML deps.
- Reach for parse-toml for TOML documents.
Gotchas & Pitfalls
- YAML 1.2 core-schema subset: Intentionally rejects duplicate mapping keys, YAML 1.1 sexagesimal/boolean quirks (
yes/noas booleans), anchors/merge keys outside the core subset, and arbitrary Python object tags. - Structured
ParseErrordiagnostics: Unsupported constructs fail fast with exact line/column diagnostics rather than silently coercing values. - Python 3.14+ & read/preserve focus: Targets Python
>=3.14with zero deps;document.to_yaml()preserves the parsed source representation rather than acting as a general YAML emitter.
Pairs With
- parse-toml & parse-xml1 — Sibling bounded structured-data parsers.
- parse-md & prettynb — Complements Markdown notebook metadata parsing.
Metadata
type: project-card
slug: parse-yaml
org: wispsy
repo: wispsy/parse-yaml
package: parse-yaml
import_name: parse_yaml
version: 0.1.0
requires_python: ">=3.14"
layer: foundation
topic: wispsy-foundation
status: active
language: python
source_docs: README.md, docs/
Linked from
Related notes
- wiki/projects/parse-toml Linked here; links to this page; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/parse-xml1 Linked here; links to this page; shared tags: #foundation, #project, #tier, #wispsy
- wiki/stack/foundation Linked here; links to this page; shared tags: #foundation, #tier, #wispsy
- wiki/projects Linked here; links to this page; shared tags: #wispsy
- wiki/projects/parse-md Linked here; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/prettynb Linked here; shared tags: #project, #tier, #wispsy
- wiki/choosing links to this page; shared tags: #tier, #wispsy
- wiki/compatibility links to this page; shared tags: #tier, #wispsy
- wiki/families links to this page; shared tags: #tier, #wispsy
- wiki/orgs/wispsy Linked here; shared tags: #tier, #wispsy