| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: appdirs |
| 3 |
Version: 1.4.4 |
| 4 |
Summary: A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir". |
| 5 |
Home-page: http://github.com/ActiveState/appdirs |
| 6 |
Author: Trent Mick |
| 7 |
Author-email: [email protected] |
| 8 |
Maintainer: Jeff Rouse |
| 9 |
Maintainer-email: [email protected] |
| 10 |
License: MIT |
| 11 |
Keywords: application directory log cache user |
| 12 |
Platform: UNKNOWN |
| 13 |
Classifier: Development Status :: 5 - Production/Stable |
| 14 |
Classifier: Intended Audience :: Developers |
| 15 |
Classifier: License :: OSI Approved :: MIT License |
| 16 |
Classifier: Operating System :: OS Independent |
| 17 |
Classifier: Programming Language :: Python :: 2 |
| 18 |
Classifier: Programming Language :: Python :: 2.7 |
| 19 |
Classifier: Programming Language :: Python :: 3 |
| 20 |
Classifier: Programming Language :: Python :: 3.4 |
| 21 |
Classifier: Programming Language :: Python :: 3.5 |
| 22 |
Classifier: Programming Language :: Python :: 3.6 |
| 23 |
Classifier: Programming Language :: Python :: 3.7 |
| 24 |
Classifier: Programming Language :: Python :: 3.8 |
| 25 |
Classifier: Programming Language :: Python :: Implementation :: PyPy |
| 26 |
Classifier: Programming Language :: Python :: Implementation :: CPython |
| 27 |
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
| 28 |
|
| 29 |
|
| 30 |
.. image:: https://secure.travis-ci.org/ActiveState/appdirs.png |
| 31 |
:target: http://travis-ci.org/ActiveState/appdirs |
| 32 |
|
| 33 |
the problem |
| 34 |
=========== |
| 35 |
|
| 36 |
What directory should your app use for storing user data? If running on Mac OS X, you |
| 37 |
should use:: |
| 38 |
|
| 39 |
~/Library/Application Support/<AppName> |
| 40 |
|
| 41 |
If on Windows (at least English Win XP) that should be:: |
| 42 |
|
| 43 |
C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\<AppName> |
| 44 |
|
| 45 |
or possibly:: |
| 46 |
|
| 47 |
C:\Documents and Settings\<User>\Application Data\<AppAuthor>\<AppName> |
| 48 |
|
| 49 |
for `roaming profiles <http://bit.ly/9yl3b6>`_ but that is another story. |
| 50 |
|
| 51 |
On Linux (and other Unices) the dir, according to the `XDG |
| 52 |
spec <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_, is:: |
| 53 |
|
| 54 |
~/.local/share/<AppName> |
| 55 |
|
| 56 |
|
| 57 |
``appdirs`` to the rescue |
| 58 |
========================= |
| 59 |
|
| 60 |
This kind of thing is what the ``appdirs`` module is for. ``appdirs`` will |
| 61 |
help you choose an appropriate: |
| 62 |
|
| 63 |
- user data dir (``user_data_dir``) |
| 64 |
- user config dir (``user_config_dir``) |
| 65 |
- user cache dir (``user_cache_dir``) |
| 66 |
- site data dir (``site_data_dir``) |
| 67 |
- site config dir (``site_config_dir``) |
| 68 |
- user log dir (``user_log_dir``) |
| 69 |
|
| 70 |
and also: |
| 71 |
|
| 72 |
- is a single module so other Python packages can include their own private copy |
| 73 |
- is slightly opinionated on the directory names used. Look for "OPINION" in |
| 74 |
documentation and code for when an opinion is being applied. |
| 75 |
|
| 76 |
|
| 77 |
some example output |
| 78 |
=================== |
| 79 |
|
| 80 |
On Mac OS X:: |
| 81 |
|
| 82 |
>>> from appdirs import * |
| 83 |
>>> appname = "SuperApp" |
| 84 |
>>> appauthor = "Acme" |
| 85 |
>>> user_data_dir(appname, appauthor) |
| 86 |
'/Users/trentm/Library/Application Support/SuperApp' |
| 87 |
>>> site_data_dir(appname, appauthor) |
| 88 |
'/Library/Application Support/SuperApp' |
| 89 |
>>> user_cache_dir(appname, appauthor) |
| 90 |
'/Users/trentm/Library/Caches/SuperApp' |
| 91 |
>>> user_log_dir(appname, appauthor) |
| 92 |
'/Users/trentm/Library/Logs/SuperApp' |
| 93 |
|
| 94 |
On Windows 7:: |
| 95 |
|
| 96 |
>>> from appdirs import * |
| 97 |
>>> appname = "SuperApp" |
| 98 |
>>> appauthor = "Acme" |
| 99 |
>>> user_data_dir(appname, appauthor) |
| 100 |
'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp' |
| 101 |
>>> user_data_dir(appname, appauthor, roaming=True) |
| 102 |
'C:\\Users\\trentm\\AppData\\Roaming\\Acme\\SuperApp' |
| 103 |
>>> user_cache_dir(appname, appauthor) |
| 104 |
'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Cache' |
| 105 |
>>> user_log_dir(appname, appauthor) |
| 106 |
'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs' |
| 107 |
|
| 108 |
On Linux:: |
| 109 |
|
| 110 |
>>> from appdirs import * |
| 111 |
>>> appname = "SuperApp" |
| 112 |
>>> appauthor = "Acme" |
| 113 |
>>> user_data_dir(appname, appauthor) |
| 114 |
'/home/trentm/.local/share/SuperApp |
| 115 |
>>> site_data_dir(appname, appauthor) |
| 116 |
'/usr/local/share/SuperApp' |
| 117 |
>>> site_data_dir(appname, appauthor, multipath=True) |
| 118 |
'/usr/local/share/SuperApp:/usr/share/SuperApp' |
| 119 |
>>> user_cache_dir(appname, appauthor) |
| 120 |
'/home/trentm/.cache/SuperApp' |
| 121 |
>>> user_log_dir(appname, appauthor) |
| 122 |
'/home/trentm/.cache/SuperApp/log' |
| 123 |
>>> user_config_dir(appname) |
| 124 |
'/home/trentm/.config/SuperApp' |
| 125 |
>>> site_config_dir(appname) |
| 126 |
'/etc/xdg/SuperApp' |
| 127 |
>>> os.environ['XDG_CONFIG_DIRS'] = '/etc:/usr/local/etc' |
| 128 |
>>> site_config_dir(appname, multipath=True) |
| 129 |
'/etc/SuperApp:/usr/local/etc/SuperApp' |
| 130 |
|
| 131 |
|
| 132 |
``AppDirs`` for convenience |
| 133 |
=========================== |
| 134 |
|
| 135 |
:: |
| 136 |
|
| 137 |
>>> from appdirs import AppDirs |
| 138 |
>>> dirs = AppDirs("SuperApp", "Acme") |
| 139 |
>>> dirs.user_data_dir |
| 140 |
'/Users/trentm/Library/Application Support/SuperApp' |
| 141 |
>>> dirs.site_data_dir |
| 142 |
'/Library/Application Support/SuperApp' |
| 143 |
>>> dirs.user_cache_dir |
| 144 |
'/Users/trentm/Library/Caches/SuperApp' |
| 145 |
>>> dirs.user_log_dir |
| 146 |
'/Users/trentm/Library/Logs/SuperApp' |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
Per-version isolation |
| 151 |
===================== |
| 152 |
|
| 153 |
If you have multiple versions of your app in use that you want to be |
| 154 |
able to run side-by-side, then you may want version-isolation for these |
| 155 |
dirs:: |
| 156 |
|
| 157 |
>>> from appdirs import AppDirs |
| 158 |
>>> dirs = AppDirs("SuperApp", "Acme", version="1.0") |
| 159 |
>>> dirs.user_data_dir |
| 160 |
'/Users/trentm/Library/Application Support/SuperApp/1.0' |
| 161 |
>>> dirs.site_data_dir |
| 162 |
'/Library/Application Support/SuperApp/1.0' |
| 163 |
>>> dirs.user_cache_dir |
| 164 |
'/Users/trentm/Library/Caches/SuperApp/1.0' |
| 165 |
>>> dirs.user_log_dir |
| 166 |
'/Users/trentm/Library/Logs/SuperApp/1.0' |
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
appdirs Changelog |
| 171 |
================= |
| 172 |
|
| 173 |
appdirs 1.4.4 |
| 174 |
------------- |
| 175 |
- [PR #92] Don't import appdirs from setup.py |
| 176 |
|
| 177 |
Project officially classified as Stable which is important |
| 178 |
for inclusion in other distros such as ActivePython. |
| 179 |
|
| 180 |
First of several incremental releases to catch up on maintenance. |
| 181 |
|
| 182 |
appdirs 1.4.3 |
| 183 |
------------- |
| 184 |
- [PR #76] Python 3.6 invalid escape sequence deprecation fixes |
| 185 |
- Fix for Python 3.6 support |
| 186 |
|
| 187 |
appdirs 1.4.2 |
| 188 |
------------- |
| 189 |
- [PR #84] Allow installing without setuptools |
| 190 |
- [PR #86] Fix string delimiters in setup.py description |
| 191 |
- Add Python 3.6 support |
| 192 |
|
| 193 |
appdirs 1.4.1 |
| 194 |
------------- |
| 195 |
- [issue #38] Fix _winreg import on Windows Py3 |
| 196 |
- [issue #55] Make appname optional |
| 197 |
|
| 198 |
appdirs 1.4.0 |
| 199 |
------------- |
| 200 |
- [PR #42] AppAuthor is now optional on Windows |
| 201 |
- [issue 41] Support Jython on Windows, Mac, and Unix-like platforms. Windows |
| 202 |
support requires `JNA <https://github.com/twall/jna>`_. |
| 203 |
- [PR #44] Fix incorrect behaviour of the site_config_dir method |
| 204 |
|
| 205 |
appdirs 1.3.0 |
| 206 |
------------- |
| 207 |
- [Unix, issue 16] Conform to XDG standard, instead of breaking it for |
| 208 |
everybody |
| 209 |
- [Unix] Removes gratuitous case mangling of the case, since \*nix-es are |
| 210 |
usually case sensitive, so mangling is not wise |
| 211 |
- [Unix] Fixes the utterly wrong behaviour in ``site_data_dir``, return result |
| 212 |
based on XDG_DATA_DIRS and make room for respecting the standard which |
| 213 |
specifies XDG_DATA_DIRS is a multiple-value variable |
| 214 |
- [Issue 6] Add ``*_config_dir`` which are distinct on nix-es, according to |
| 215 |
XDG specs; on Windows and Mac return the corresponding ``*_data_dir`` |
| 216 |
|
| 217 |
appdirs 1.2.0 |
| 218 |
------------- |
| 219 |
|
| 220 |
- [Unix] Put ``user_log_dir`` under the *cache* dir on Unix. Seems to be more |
| 221 |
typical. |
| 222 |
- [issue 9] Make ``unicode`` work on py3k. |
| 223 |
|
| 224 |
appdirs 1.1.0 |
| 225 |
------------- |
| 226 |
|
| 227 |
- [issue 4] Add ``AppDirs.user_log_dir``. |
| 228 |
- [Unix, issue 2, issue 7] appdirs now conforms to `XDG base directory spec |
| 229 |
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_. |
| 230 |
- [Mac, issue 5] Fix ``site_data_dir()`` on Mac. |
| 231 |
- [Mac] Drop use of 'Carbon' module in favour of hardcoded paths; supports |
| 232 |
Python3 now. |
| 233 |
- [Windows] Append "Cache" to ``user_cache_dir`` on Windows by default. Use |
| 234 |
``opinion=False`` option to disable this. |
| 235 |
- Add ``appdirs.AppDirs`` convenience class. Usage: |
| 236 |
|
| 237 |
>>> dirs = AppDirs("SuperApp", "Acme", version="1.0") |
| 238 |
>>> dirs.user_data_dir |
| 239 |
'/Users/trentm/Library/Application Support/SuperApp/1.0' |
| 240 |
|
| 241 |
- [Windows] Cherry-pick Komodo's change to downgrade paths to the Windows short |
| 242 |
paths if there are high bit chars. |
| 243 |
- [Linux] Change default ``user_cache_dir()`` on Linux to be singular, e.g. |
| 244 |
"~/.superapp/cache". |
| 245 |
- [Windows] Add ``roaming`` option to ``user_data_dir()`` (for use on Windows only) |
| 246 |
and change the default ``user_data_dir`` behaviour to use a *non*-roaming |
| 247 |
profile dir (``CSIDL_LOCAL_APPDATA`` instead of ``CSIDL_APPDATA``). Why? Because |
| 248 |
a large roaming profile can cause login speed issues. The "only syncs on |
| 249 |
logout" behaviour can cause surprises in appdata info. |
| 250 |
|
| 251 |
|
| 252 |
appdirs 1.0.1 (never released) |
| 253 |
------------------------------ |
| 254 |
|
| 255 |
Started this changelog 27 July 2010. Before that this module originated in the |
| 256 |
`Komodo <http://www.activestate.com/komodo>`_ product as ``applib.py`` and then |
| 257 |
as `applib/location.py |
| 258 |
<http://github.com/ActiveState/applib/blob/master/applib/location.py>`_ (used by |
| 259 |
`PyPM <http://code.activestate.com/pypm/>`_ in `ActivePython |
| 260 |
<http://www.activestate.com/activepython>`_). This is basically a fork of |
| 261 |
applib.py 1.0.1 and applib/location.py 1.0.1. |
| 262 |
|
| 263 |
|
| 264 |
|