Exporting Config

class omnifig.exporting.ConfigExporter

Bases: SimpleExporterBase

Exporter for config objects, can load and save config objects in four formats: json, yaml, toml, and the native “.fig.yml” format (which is equivalent to yaml).

export_payload(src, payload, path, *, fmt=None, **kwargs)

Exports the given payload to the given path.

Parameters:
  • src (AbstractExportManager) – manager used for delegating the export to a different format

  • payload (ConfigNode) – config object to be exported

  • path (Path) – destination path for the export

  • fmt (Optional[str]) – format to use for the export (if None, will be inferred from the path, defaults to .fig.yml)

Return type:

Path

Returns:

the path to the exported file (or None if the export failed)