
On 01.09.15 11:00, Philipp A. wrote:
When defining a place for config files, cache files, and so on, people usually hack around in a OS-dependent, misinformed, and therefore wrong way.
Thanks to the tempfile API we at least don’t see people hardcoding /tmp/ too much.
There is a beautiful little module that does things right and is easy to use: appdirs <https://pypi.python.org/pypi/appdirs>
TI think this is a *really* good candidate for the stdlib since this functionality is useful for everything that needs a cache or config (so not only GUI and CLI applications, but also scripts that download and cache stuff from the internet for faster re-running)
probably we should build the API around pathlib, since i found myself not touching os.path with a barge pole since pathlib exists.
i’ll write a PEP about this soon :)
site_data_dir() returns a string. It contains multiple paths separated with path delimiter if multipath=True. I think that a function that returns a list of paths, including user dir, would be more helpful and Pythonic. See also PyXDG (http://www.freedesktop.org/wiki/Software/pyxdg/).