python-platformdirs
Port variant py38
Summary Finds platform-specific directories (PY38)
Package version 2.4.0
Homepage https://github.com/platformdirs/platformdirs
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants py39
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 26 SEP 2021, 03:42:31 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 module 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 a single module so other Python packages can vendor their own private copy. - 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
Configuration Switches (platform-specific settings discarded)
PY38 ON Build using Python 3.8 PY39 OFF Build using Python 3.9
Package Dependencies by Type
Build (only) python-pip:single:py38
autoselect-python:single:standard
Build and Runtime python38:single:standard
Download groups
main mirror://PYPIWHL/b1/78/dcfd84d3aabd46a9c77260fb47ea5d244806e4daef83aa6fe5d83adb182c
Distribution File Information
8868bbe3c3c80d42f20156f22e7131d2fb321f5bc86a2a345375c6481a67021d 14400 platformdirs-2.4.0-py3-none-any.whl
Ports that require python-platformdirs:py38
python-black:py38 Uncompromising code formatter (PY38)
python-pylint:py38 Python code static checker (PY38)
python-virtualenv:py38 Virtual Python Environment builder (PY38)