gsplot.write_meta#

write_meta(snapshot, destination, *, overwrite=False, create_parent=False)#

Write one stable UTF-8 metadata document to an explicit destination.

Parameters:
  • snapshot (MetadataSnapshot) – Privacy-bounded immutable metadata values.

  • destination (str | PathLike[str]) – Caller-owned JSON destination.

  • overwrite (bool) – Atomically replace an existing destination when True; otherwise use exclusive creation.

  • create_parent (bool) – Create a missing parent directory only when explicitly enabled.

Returns:

The absolute destination path.

Return type:

pathlib.Path

Raises:

MetadataError – If validation, parent creation, serialization, or atomic writing fails. No implicit metadata is collected.

Examples

>>> import gsplot as gs
>>> snapshot = gs.MetadataSnapshot(package_version=gs.__version__)
>>> path = gs.write_meta(snapshot, "meta.json", overwrite=True)
>>> path.suffix
'.json'