platformdirs
A Python package for determining platform-specific directories (e.g. user data, config, cache, logs). Handles the differences between macOS, Windows, Linux/Unix, and Android so you don't have to.
Quick start
from platformdirs import PlatformDirs
dirs = PlatformDirs("MyApp", "MyCompany")
dirs.user_data_dir # ~/.local/share/MyApp (Linux)
dirs.user_config_dir # ~/.config/MyApp (Linux)
dirs.user_cache_dir # ~/.cache/MyApp (Linux)
dirs.user_state_dir # ~/.local/state/MyApp (Linux)
dirs.user_log_dir # ~/.local/state/MyApp/log (Linux)
dirs.user_documents_dir # ~/Documents
dirs.user_downloads_dir # ~/Downloads
dirs.user_runtime_dir # /run/user/<uid>/MyApp (Linux)
For Path objects instead of strings:
from platformdirs import PlatformDirs
dirs = PlatformDirs("MyApp", "MyCompany")
dirs.user_data_path # pathlib.Path('~/.local/share/MyApp')
dirs.user_config_path # pathlib.Path('~/.config/MyApp')
Convenience functions for quick access:
from platformdirs import user_data_dir, user_config_path
user_data_dir("MyApp", "MyCompany") # returns str
user_config_path("MyApp", "MyCompany") # returns pathlib.Path
Directory types
Application directories — scoped to your app name and version:
- Data: Persistent application data (
user_data_dir,site_data_dir) - Config: Configuration files and settings (
user_config_dir,site_config_dir) - Preference: User preferences, distinct from config on macOS (
user_preference_dir) - Cache: Cached data that can be regenerated (
user_cache_dir,site_cache_dir) - State: Non-essential runtime state like window positions (
user_state_dir,site_state_dir) - Logs: Log files (
user_log_dir,site_log_dir) - Runtime: Runtime files like sockets and PIDs (
user_runtime_dir,site_runtime_dir)
App dirs have both user_* (per-user, writable) and site_* (system-wide, read-only) variants where applicable.
User media directories — standard user-facing folders, not scoped to app name:
- Documents (
user_documents_dir), Downloads (user_downloads_dir) - Pictures (
user_pictures_dir), Videos (user_videos_dir), Music (user_music_dir) - Desktop (
user_desktop_dir), Projects (user_projects_dir) - Public share (
user_publicshare_dir), Templates (user_templates_dir) - Fonts (
user_fonts_dir) — user-writable font installation directory - Executable (
user_bin_dir,site_bin_dir), Applications (user_applications_dir,site_applications_dir)
Documentation
Full documentation is available at platformdirs.readthedocs.io:
- Getting started tutorial -- learn core concepts through real-world examples
- How-to guides -- recipes for common tasks and platform-specific tips
- API reference -- complete list of functions and classes
- Platform details -- default paths for each operating system
Contributions are welcome! See CONTRIBUTING.md for details.
Release files for platformdirs 4.11.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| platformdirs-4.11.12.tar.gz | 40.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| platformdirs-4.11.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.0 kB
Release files / platformdirs-4.11.12.tar.gz
| Download URL | platformdirs-4.11.12.tar.gz |
|---|---|
| Size | 40.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8dc1cb58f1153fd7f61db1374317770baababec2480b37b8f01c6cc25b45267
|
|
BLAKE2b-256 checksum How to use checksums |
eadd65804b0c2925a1c821a05502ea57517b69a073ff400d25ab9faa3a2cf012
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / platformdirs-4.11.12-py3-none-any.whl
| Download URL | platformdirs-4.11.12-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1ba966ac76153d9985a0787ffab951e7c18416189873d4e4ddb2c8a04a0a254
|
|
BLAKE2b-256 checksum How to use checksums |
ec2b69de6317fbf48865bb12aa56c9cfcfff46b3add0cd45250725d96146dce0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency log