Documentation: https://jalvaradosegura.github.io/tmp-folder/
Easily create a temporary folder. Put files in it and after you're done tmp-folder will delete the folder automatically.
Install from PyPI:
pip install tmp-folder
This is the minimum you need to get started with tmp-folder
:
from pathlib import Path
from tmp_folder import use_tmp_folder
@use_tmp_folder
def foo(tmp_folder: Path):
pass
Just decorate the function in which you need a temporary folder. Then add as first parameter, the variable that will hold the temporary folder path (it can be named however you want). Finally, after the function execution is completed, the folder will be deleted.