uwtools.api.rocoto

API access to uwtools Rocoto support.

uwtools.api.rocoto.realize(config: Optional[Union[YAMLConfig, Path, str]], output_file: Optional[Union[str, Path]] = None, stdin_ok: bool = False) bool

Realize the Rocoto workflow defined in the given YAML as XML.

If no input file is specified, stdin is read. A YAMLConfig object may also be provided as input. If no output file is specified, stdout is written to. Both the input config and output Rocoto XML will be validated against appropriate schcemas.

Parameters
  • config – Path to YAML input file (None or unspecified => read stdin), or YAMLConfig object

  • output_file – Path to write rendered XML file (None or unspecified => write to stdout)

  • stdin_ok – OK to read from stdin?

Returns

True

uwtools.api.rocoto.validate(xml_file: Optional[Union[str, Path]] = None, stdin_ok: bool = False) bool

Validate purported Rocoto XML file against its schema.

Parameters
  • xml_file – Path to XML file (None or unspecified => read stdin)

  • stdin_ok – OK to read from stdin?

Returns

True if the XML conforms to the schema, False otherwise