httk.core.atomic_write¶
Exception-safe local file replacement for filename-sensitive format writers.
Functions¶
|
Yield a same-filesystem staging path and publish it only on success. |
Module Contents¶
- httk.core.atomic_write.atomic_destination(destination)[source]¶
Yield a same-filesystem staging path and publish it only on success.
Follow symlinks, preserve existing permission bits, and retain the requested basename for filename-sensitive writers. Replacing a hard link leaves its other links unchanged. This does not provide crash durability or serialize concurrent writers. The caller must close all output streams before exit.
- Parameters:
destination (str | os.PathLike[str]) – Output filename whose resolved parent directory exists.
- Yields:
A staging path retaining the requested basename for the writer.
- Raises:
ValueError – If the resolved destination exists and is not a regular file.
OSError – If staging or publishing the output fails.