reci.yaml_gen¶
YAML I/O wrapper using ruamel.yaml (YAML 1.2).
Handles the critical on: key (PyYAML treats it as boolean True),
wraps ${{ }} expressions in SingleQuotedScalarString, and uses
LiteralScalarString for multiline run: blocks.
Functions
|
Serialize a workflow dict to GitHub Actions YAML. |
|
Load a YAML file and return a plain dict. |
|
Load YAML from a string and return a plain dict. |
|
A YAML number as written in the source, not as Python renders it. |
- reci.yaml_gen.dump_workflow(workflow, *, stream=None)[source]¶
Serialize a workflow dict to GitHub Actions YAML.
If stream is
None, returns the YAML string. Otherwise writes to stream and returnsNone.
- reci.yaml_gen.load_yaml_string(text)[source]¶
Load YAML from a string and return a plain dict.
- Return type:
- reci.yaml_gen.scalar_source_text(value)[source]¶
A YAML number as written in the source, not as Python renders it.
ruamel keeps the spelling of what it loads, so
3.10stays3.10(str()gives3.1),0x1Fstays0x1Fand1e3stays1e3. Anchors and tags are not part of the spelling. When ruamel’s text would be a different number (negative hex, underscored floats),str()is used.- Return type:
>>> scalar_source_text(load_yaml_string("v: 3.10")["v"]) '3.10' >>> scalar_source_text(load_yaml_string("v: &a 0x1F")["v"]) '0x1F' >>> scalar_source_text(7) '7'