python-platformdirs
Port variant py39
Summary Finds platform-specific directories (3.9)
Package version 2.6.0
Homepage No known homepage
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants py310
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 09 DEC 2022, 21:46:33 UTC
Port created 15 JUL 2021, 22:41:18 UTC
Subpackage Descriptions
single The problem =========== When writing desktop application, finding the right location to store user data and configuration varies per platform. Even for single-platform apps, there may by plenty of nuances in figuring out the right location. For example, if running on macOS, you should use:: ~/Library/Application Support/ If on Windows (at least English Win XP) that should be:: C:\Documents and Settings\\Application Data\Local Settings\\ or possibly:: C:\Documents and Settings\\Application Data\\ for [roaming profiles] but that is another story. On Linux (and other Unices), according to the `XDG Basedir Spec`_, it should be:: ~/.local/share/ .. _XDG Basedir Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html platformdirs to the rescue ============================== This kind of thing is what the platformdirs package is for. platformdirs will help you choose an appropriate: - user data dir (user_data_dir) - user config dir (user_config_dir) - user cache dir (user_cache_dir) - site data dir (site_data_dir) - site config dir (site_config_dir) - user log dir (user_log_dir) - user documents dir (user_documents_dir) - user runtime dir (user_runtime_dir) And also: - Is slightly opinionated on the directory names used. Look for "OPINION" in documentation and code for when an opinion is being applied. Example output ============== On macOS: .. code-block:: pycon >>> from platformdirs import * >>> appname = "SuperApp" >>> appauthor = "Acme" >>> user_data_dir(appname, appauthor) '/Users/trentm/Library/Application Support/SuperApp' >>> site_data_dir(appname, appauthor) '/Library/Application Support/SuperApp' >>> user_cache_dir(appname, appauthor) '/Users/trentm/Library/Caches/SuperApp' >>> user_log_dir(appname, appauthor) '/Users/trentm/Library/Logs/SuperApp' >>> user_documents_dir() '/Users/trentm/Documents' >>> user_runtime_dir(appname, appauthor) '/Users/trentm/Library/Caches/TemporaryItems/SuperApp' On Windows 7: .. code-block:: pycon >>> from platformdirs import * >>> appname = "SuperApp" >>> appauthor = "Acme" >>> user_data_dir(appname, appauthor) 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp' >>> user_data_dir(appname, appauthor, roaming=True) 'C:\\Users\\trentm\\AppData\\Roaming\\Acme\\SuperApp' >>> user_cache_dir(appname, appauthor) 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Cache' >>> user_log_dir(appname, appauthor) 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs' >>> user_documents_dir() 'C:\\Users\\trentm\\Documents' >>> user_runtime_dir(appname, appauthor) 'C:\\Users\\trentm\\AppData\\Local\\Temp\\Acme\\SuperApp' On Linux: .. code-block:: pycon >>> from platformdirs import *
Configuration Switches (platform-specific settings discarded)
PY310 OFF Build using Python 3.10 PY39 ON Build using Python 3.9
Package Dependencies by Type
Build (only) python-pip:single:py39
autoselect-python:single:standard
Build and Runtime python39:single:standard
Download groups
main mirror://PYPIWHL/87/69/cd019a9473bcdfb38983e2d550ccb239264fc4c2fc32c42ac1b1cc2506b6
Distribution File Information
1a89a12377800c81983db6be069ec068eee989748799b946cce2a6e80dcc54ca 14264 platformdirs-2.6.0-py3-none-any.whl
Ports that require python-platformdirs:py39
python-black:py39 Uncompromising code formatter (3.9)
python-pylint:py39 Python code static checker (3.9)
python-virtualenv:py39 Virtual Python Environment builder (3.9)