python-platformdirs
Port variant v11
Summary Finds platform-specific directories (3.11)
BROKEN
Package version 4.3.6
Homepage https://github.com/tox-dev/platformdirs
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v12
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 21 SEP 2024, 20:11:51 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) 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 downloads dir (user_downloads_dir) - user pictures dir (user_pictures_dir) - user videos dir (user_videos_dir) - user music dir (user_music_dir) - user desktop dir (user_desktop_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_downloads_dir() '/Users/trentm/Downloads' >>> user_pictures_dir() '/Users/trentm/Pictures' >>> user_videos_dir() '/Users/trentm/Movies' >>> user_music_dir() '/Users/trentm/Music' >>> user_desktop_dir() '/Users/trentm/Desktop' >>> user_runtime_dir(appname, appauthor) '/Users/trentm/Library/Caches/TemporaryItems/SuperApp' On Windows: .. 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)
Configuration Switches (platform-specific settings discarded)
PY311 ON Build using Python 3.11 PY312 OFF Build using Python 3.12
Package Dependencies by Type
Build (only) python-pip:single:v11
autoselect-python:single:std
Build and Runtime python311:single:std
Download groups
main mirror://PYPIWHL/3c/a6/bc1012356d8ece4d66dd75c4b9fc6c1f6650ddd5991e421177d9f8f671be
Distribution File Information
73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb 18439 platformdirs-4.3.6-py3-none-any.whl
Ports that require python-platformdirs:v11
python-black:v11 Uncompromising code formatter (3.11)
python-mkdocs-get-deps:v11 List dependencies from by mydocs.yml file (3.11)
python-mkdocstrings:v11 Documentation from sources for MkDocs (3.11)
python-pylint:v11 Python code static checker (3.11)
python-requests-cache:v11 Persistent cache for python requests (3.11)
python-virtualenv:v11 Virtual Python Environment builder (3.11)
python-xml2rfc:v11 Request For Comment authoring with XML (3.11)
python-yapf:v11 Formatter for Python code (3.11)