Debian Codegraph @

third_party/python/platformdirs/platformdirs-4.3.6.dist-info/METADATA

raw
1 Metadata-Version: 2.3
2 Name: platformdirs
3 Version: 4.3.6
4 Summary: A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`.
5 Project-URL: Changelog, https://github.com/tox-dev/platformdirs/releases
6 Project-URL: Documentation, https://platformdirs.readthedocs.io
7 Project-URL: Homepage, https://github.com/tox-dev/platformdirs
8 Project-URL: Source, https://github.com/tox-dev/platformdirs
9 Project-URL: Tracker, https://github.com/tox-dev/platformdirs/issues
10 Maintainer-email: Bernát Gábor <[email protected]>, Julian Berman <[email protected]>, Ofek Lev <[email protected]>, Ronny Pfannschmidt <[email protected]>
11 License-Expression: MIT
12 License-File: LICENSE
13 Keywords: appdirs,application,cache,directory,log,user
14 Classifier: Development Status :: 5 - Production/Stable
15 Classifier: Intended Audience :: Developers
16 Classifier: License :: OSI Approved :: MIT License
17 Classifier: Operating System :: OS Independent
18 Classifier: Programming Language :: Python
19 Classifier: Programming Language :: Python :: 3 :: Only
20 Classifier: Programming Language :: Python :: 3.8
21 Classifier: Programming Language :: Python :: 3.9
22 Classifier: Programming Language :: Python :: 3.10
23 Classifier: Programming Language :: Python :: 3.11
24 Classifier: Programming Language :: Python :: 3.12
25 Classifier: Programming Language :: Python :: 3.13
26 Classifier: Programming Language :: Python :: Implementation :: CPython
27 Classifier: Programming Language :: Python :: Implementation :: PyPy
28 Classifier: Topic :: Software Development :: Libraries :: Python Modules
29 Requires-Python: >=3.8
30 Provides-Extra: docs
31 Requires-Dist: furo>=2024.8.6; extra == 'docs'
32 Requires-Dist: proselint>=0.14; extra == 'docs'
33 Requires-Dist: sphinx-autodoc-typehints>=2.4; extra == 'docs'
34 Requires-Dist: sphinx>=8.0.2; extra == 'docs'
35 Provides-Extra: test
36 Requires-Dist: appdirs==1.4.4; extra == 'test'
37 Requires-Dist: covdefaults>=2.3; extra == 'test'
38 Requires-Dist: pytest-cov>=5; extra == 'test'
39 Requires-Dist: pytest-mock>=3.14; extra == 'test'
40 Requires-Dist: pytest>=8.3.2; extra == 'test'
41 Provides-Extra: type
42 Requires-Dist: mypy>=1.11.2; extra == 'type'
43 Description-Content-Type: text/x-rst
44
45 The problem
46 ===========
47
48 .. image:: https://badge.fury.io/py/platformdirs.svg
49 :target: https://badge.fury.io/py/platformdirs
50 .. image:: https://img.shields.io/pypi/pyversions/platformdirs.svg
51 :target: https://pypi.python.org/pypi/platformdirs/
52 .. image:: https://github.com/tox-dev/platformdirs/actions/workflows/check.yaml/badge.svg
53 :target: https://github.com/platformdirs/platformdirs/actions
54 .. image:: https://static.pepy.tech/badge/platformdirs/month
55 :target: https://pepy.tech/project/platformdirs
56
57 When writing desktop application, finding the right location to store user data
58 and configuration varies per platform. Even for single-platform apps, there
59 may by plenty of nuances in figuring out the right location.
60
61 For example, if running on macOS, you should use::
62
63 ~/Library/Application Support/<AppName>
64
65 If on Windows (at least English Win) that should be::
66
67 C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\<AppName>
68
69 or possibly::
70
71 C:\Documents and Settings\<User>\Application Data\<AppAuthor>\<AppName>
72
73 for `roaming profiles <https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc766489(v=ws.10)>`_ but that is another story.
74
75 On Linux (and other Unices), according to the `XDG Basedir Spec`_, it should be::
76
77 ~/.local/share/<AppName>
78
79 .. _XDG Basedir Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
80
81 ``platformdirs`` to the rescue
82 ==============================
83
84 This kind of thing is what the ``platformdirs`` package is for.
85 ``platformdirs`` will help you choose an appropriate:
86
87 - user data dir (``user_data_dir``)
88 - user config dir (``user_config_dir``)
89 - user cache dir (``user_cache_dir``)
90 - site data dir (``site_data_dir``)
91 - site config dir (``site_config_dir``)
92 - user log dir (``user_log_dir``)
93 - user documents dir (``user_documents_dir``)
94 - user downloads dir (``user_downloads_dir``)
95 - user pictures dir (``user_pictures_dir``)
96 - user videos dir (``user_videos_dir``)
97 - user music dir (``user_music_dir``)
98 - user desktop dir (``user_desktop_dir``)
99 - user runtime dir (``user_runtime_dir``)
100
101 And also:
102
103 - Is slightly opinionated on the directory names used. Look for "OPINION" in
104 documentation and code for when an opinion is being applied.
105
106 Example output
107 ==============
108
109 On macOS:
110
111 .. code-block:: pycon
112
113 >>> from platformdirs import *
114 >>> appname = "SuperApp"
115 >>> appauthor = "Acme"
116 >>> user_data_dir(appname, appauthor)
117 '/Users/trentm/Library/Application Support/SuperApp'
118 >>> site_data_dir(appname, appauthor)
119 '/Library/Application Support/SuperApp'
120 >>> user_cache_dir(appname, appauthor)
121 '/Users/trentm/Library/Caches/SuperApp'
122 >>> user_log_dir(appname, appauthor)
123 '/Users/trentm/Library/Logs/SuperApp'
124 >>> user_documents_dir()
125 '/Users/trentm/Documents'
126 >>> user_downloads_dir()
127 '/Users/trentm/Downloads'
128 >>> user_pictures_dir()
129 '/Users/trentm/Pictures'
130 >>> user_videos_dir()
131 '/Users/trentm/Movies'
132 >>> user_music_dir()
133 '/Users/trentm/Music'
134 >>> user_desktop_dir()
135 '/Users/trentm/Desktop'
136 >>> user_runtime_dir(appname, appauthor)
137 '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
138
139 On Windows:
140
141 .. code-block:: pycon
142
143 >>> from platformdirs import *
144 >>> appname = "SuperApp"
145 >>> appauthor = "Acme"
146 >>> user_data_dir(appname, appauthor)
147 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp'
148 >>> user_data_dir(appname, appauthor, roaming=True)
149 'C:\\Users\\trentm\\AppData\\Roaming\\Acme\\SuperApp'
150 >>> user_cache_dir(appname, appauthor)
151 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Cache'
152 >>> user_log_dir(appname, appauthor)
153 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs'
154 >>> user_documents_dir()
155 'C:\\Users\\trentm\\Documents'
156 >>> user_downloads_dir()
157 'C:\\Users\\trentm\\Downloads'
158 >>> user_pictures_dir()
159 'C:\\Users\\trentm\\Pictures'
160 >>> user_videos_dir()
161 'C:\\Users\\trentm\\Videos'
162 >>> user_music_dir()
163 'C:\\Users\\trentm\\Music'
164 >>> user_desktop_dir()
165 'C:\\Users\\trentm\\Desktop'
166 >>> user_runtime_dir(appname, appauthor)
167 'C:\\Users\\trentm\\AppData\\Local\\Temp\\Acme\\SuperApp'
168
169 On Linux:
170
171 .. code-block:: pycon
172
173 >>> from platformdirs import *
174 >>> appname = "SuperApp"
175 >>> appauthor = "Acme"
176 >>> user_data_dir(appname, appauthor)
177 '/home/trentm/.local/share/SuperApp'
178 >>> site_data_dir(appname, appauthor)
179 '/usr/local/share/SuperApp'
180 >>> site_data_dir(appname, appauthor, multipath=True)
181 '/usr/local/share/SuperApp:/usr/share/SuperApp'
182 >>> user_cache_dir(appname, appauthor)
183 '/home/trentm/.cache/SuperApp'
184 >>> user_log_dir(appname, appauthor)
185 '/home/trentm/.local/state/SuperApp/log'
186 >>> user_config_dir(appname)
187 '/home/trentm/.config/SuperApp'
188 >>> user_documents_dir()
189 '/home/trentm/Documents'
190 >>> user_downloads_dir()
191 '/home/trentm/Downloads'
192 >>> user_pictures_dir()
193 '/home/trentm/Pictures'
194 >>> user_videos_dir()
195 '/home/trentm/Videos'
196 >>> user_music_dir()
197 '/home/trentm/Music'
198 >>> user_desktop_dir()
199 '/home/trentm/Desktop'
200 >>> user_runtime_dir(appname, appauthor)
201 '/run/user/{os.getuid()}/SuperApp'
202 >>> site_config_dir(appname)
203 '/etc/xdg/SuperApp'
204 >>> os.environ["XDG_CONFIG_DIRS"] = "/etc:/usr/local/etc"
205 >>> site_config_dir(appname, multipath=True)
206 '/etc/SuperApp:/usr/local/etc/SuperApp'
207
208 On Android::
209
210 >>> from platformdirs import *
211 >>> appname = "SuperApp"
212 >>> appauthor = "Acme"
213 >>> user_data_dir(appname, appauthor)
214 '/data/data/com.myApp/files/SuperApp'
215 >>> user_cache_dir(appname, appauthor)
216 '/data/data/com.myApp/cache/SuperApp'
217 >>> user_log_dir(appname, appauthor)
218 '/data/data/com.myApp/cache/SuperApp/log'
219 >>> user_config_dir(appname)
220 '/data/data/com.myApp/shared_prefs/SuperApp'
221 >>> user_documents_dir()
222 '/storage/emulated/0/Documents'
223 >>> user_downloads_dir()
224 '/storage/emulated/0/Downloads'
225 >>> user_pictures_dir()
226 '/storage/emulated/0/Pictures'
227 >>> user_videos_dir()
228 '/storage/emulated/0/DCIM/Camera'
229 >>> user_music_dir()
230 '/storage/emulated/0/Music'
231 >>> user_desktop_dir()
232 '/storage/emulated/0/Desktop'
233 >>> user_runtime_dir(appname, appauthor)
234 '/data/data/com.myApp/cache/SuperApp/tmp'
235
236 Note: Some android apps like Termux and Pydroid are used as shells. These
237 apps are used by the end user to emulate Linux environment. Presence of
238 ``SHELL`` environment variable is used by Platformdirs to differentiate
239 between general android apps and android apps used as shells. Shell android
240 apps also support ``XDG_*`` environment variables.
241
242
243 ``PlatformDirs`` for convenience
244 ================================
245
246 .. code-block:: pycon
247
248 >>> from platformdirs import PlatformDirs
249 >>> dirs = PlatformDirs("SuperApp", "Acme")
250 >>> dirs.user_data_dir
251 '/Users/trentm/Library/Application Support/SuperApp'
252 >>> dirs.site_data_dir
253 '/Library/Application Support/SuperApp'
254 >>> dirs.user_cache_dir
255 '/Users/trentm/Library/Caches/SuperApp'
256 >>> dirs.user_log_dir
257 '/Users/trentm/Library/Logs/SuperApp'
258 >>> dirs.user_documents_dir
259 '/Users/trentm/Documents'
260 >>> dirs.user_downloads_dir
261 '/Users/trentm/Downloads'
262 >>> dirs.user_pictures_dir
263 '/Users/trentm/Pictures'
264 >>> dirs.user_videos_dir
265 '/Users/trentm/Movies'
266 >>> dirs.user_music_dir
267 '/Users/trentm/Music'
268 >>> dirs.user_desktop_dir
269 '/Users/trentm/Desktop'
270 >>> dirs.user_runtime_dir
271 '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
272
273 Per-version isolation
274 =====================
275
276 If you have multiple versions of your app in use that you want to be
277 able to run side-by-side, then you may want version-isolation for these
278 dirs::
279
280 >>> from platformdirs import PlatformDirs
281 >>> dirs = PlatformDirs("SuperApp", "Acme", version="1.0")
282 >>> dirs.user_data_dir
283 '/Users/trentm/Library/Application Support/SuperApp/1.0'
284 >>> dirs.site_data_dir
285 '/Library/Application Support/SuperApp/1.0'
286 >>> dirs.user_cache_dir
287 '/Users/trentm/Library/Caches/SuperApp/1.0'
288 >>> dirs.user_log_dir
289 '/Users/trentm/Library/Logs/SuperApp/1.0'
290 >>> dirs.user_documents_dir
291 '/Users/trentm/Documents'
292 >>> dirs.user_downloads_dir
293 '/Users/trentm/Downloads'
294 >>> dirs.user_pictures_dir
295 '/Users/trentm/Pictures'
296 >>> dirs.user_videos_dir
297 '/Users/trentm/Movies'
298 >>> dirs.user_music_dir
299 '/Users/trentm/Music'
300 >>> dirs.user_desktop_dir
301 '/Users/trentm/Desktop'
302 >>> dirs.user_runtime_dir
303 '/Users/trentm/Library/Caches/TemporaryItems/SuperApp/1.0'
304
305 Be wary of using this for configuration files though; you'll need to handle
306 migrating configuration files manually.
307
308 Why this Fork?
309 ==============
310
311 This repository is a friendly fork of the wonderful work started by
312 `ActiveState <https://github.com/ActiveState/appdirs>`_ who created
313 ``appdirs``, this package's ancestor.
314
315 Maintaining an open source project is no easy task, particularly
316 from within an organization, and the Python community is indebted
317 to ``appdirs`` (and to Trent Mick and Jeff Rouse in particular) for
318 creating an incredibly useful simple module, as evidenced by the wide
319 number of users it has attracted over the years.
320
321 Nonetheless, given the number of long-standing open issues
322 and pull requests, and no clear path towards `ensuring
323 that maintenance of the package would continue or grow
324 <https://github.com/ActiveState/appdirs/issues/79>`_, this fork was
325 created.
326
327 Contributions are most welcome.