uwtools.api.rocoto

https://mybinder.org/badge_logo.svg

API access to uwtools Rocoto support.

uwtools.api.rocoto.realize(config, output_file=None, stdin_ok=False)

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 schemas.

Parameters:
  • config (_YAMLConfig | Path | str | None) – YAML input file or YAMLConfig object (None => read stdin).

  • output_file (Path | str | None) – XML output file path (None => write to stdout).

  • stdin_ok (bool) – OK to read from stdin?

Returns:

True.

Return type:

bool

uwtools.api.rocoto.validate(xml_file=None, stdin_ok=False)

Validate purported Rocoto XML file against its schema.

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

  • stdin_ok (bool) – OK to read from stdin?

Returns:

True if the XML conforms to the schema, False otherwise.

Return type:

bool