pythontempdatatempdir

Temporary directory persist across program runs


I need a temporary directory, but I want full control over its creation and deletion.

I will use this directory to place git repositories which I want to monitor for new commits, so I need to store them somewhere permanently.

Therefore I want to avoid /tmp dir, since it can be cleared by user(?). What is the best practice for this?


Solution

  • https://pypi.python.org/pypi/platformdirs is a Python package that offers a cross-platform user_cache_dir function.