pydox.tmp_root

Contents

pydox.tmp_root#

tmp_root(new: bool = False, config: object | None = None) → Path[source]#

Return a temporary folder path

Parameters:
  • new (bool, default = False) – Force create a new temporary folder on each call.

  • config (Config, default = None) – The configuration object to read the output.root parameter from. If set to None (default), we use the runtime configuration object.

Return type:

pathlib.Path

Notes

The temporary folder is named after the exact creation datetime stamp, following the general format:

<output.root>/tmp/<%Y%m%d%H%M%S%f>

Eg: If output.root is set to: /Users/johndoe/pydox then the temporary folder is something like: /Users/johndoe/pydox/tmp/20260717100903168376.

Note that if the output.root configuration parameter is not set, we fall back on the current working directory.

Also note that a unique temporary folder is created at runtime, therefore, calling do.tmp_root() twice will return the same result.

In order to force create a new temporary folder, use the argument new=True.