phenotypic.sdk_.atomic_write_json#
- phenotypic.sdk_.atomic_write_json(path: str | Path, payload: Mapping[str, Any] | list[Any], *, indent: int = 2, sort_keys: bool = True, ensure_ascii: bool = False, pre_replace: Callable[[], None] | None = None, commit_guard: Callable[[], AbstractContextManager[None]] | None = None) None[source]#
Atomically write a JSON payload with deterministic formatting.
- Parameters:
payload (Mapping[str, Any] | list[Any]) – JSON-serializable mapping or list.
indent (int) – Indentation passed to
json.dumps().sort_keys (bool) – Whether mapping keys are sorted for deterministic output.
ensure_ascii (bool) – Whether non-ASCII characters are escaped.
pre_replace (Callable[[], None] | None) – Optional callback invoked immediately before publication.
commit_guard (Callable[[], AbstractContextManager[None]] | None)
- Return type:
None