[Python-ideas] Add appdirs module to stdlib

Florian Bruhin me at the-compiler.org
Wed Sep 2 06:18:46 CEST 2015


* Philipp A. <flying-sheep at web.de> [2015-09-01 08:00:21 +0000]:
> 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)

+1 from me as well.

Another source for inspirations might be the QStandardPaths class from
the Qt library (which is C++, but I'm using QStandardPaths in my PyQt
applicaiton):

http://doc.qt.io/qt-5/qstandardpaths.html

They have a QStandardPath::writableLocation which gives you exactly
one path to write to, a QStandardPath::standardLocations which gives
you a list of paths, and a QStandardPath::locate which locates your
config based on a name.

They also had the issue with changing standards such as Local/Roaming
appdata on Windows, and solved it by introducing more enum values to
the StandardLocation enum:

    QStandardPaths::DataLocation
        Returns the same value as AppLocalDataLocation. This
        enumeration value is deprecated. Using AppDataLocation is
        preferable since on Windows, the roaming path is recommended.

    QStandardPaths::AppDataLocation
        Returns a directory location where persistent application data
        can be stored. This is an application-specific directory. To
        obtain a path to store data to be shared with other
        applications, use QStandardPaths::GenericDataLocation. The
        returned path is never empty. On the Windows operating system,
        this returns the roaming path. This enum value was added in Qt
        5.4.

    QStandardPaths::AppLocalDataLocation
        Returns the local settings path on the Windows operating
        system.  On all other platforms, it returns the same value as
        AppDataLocation. This enum value was added in Qt 5.4.

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150902/c01eb355/attachment.sig>


More information about the Python-ideas mailing list