| 1 |
Metadata-Version: 2.4 |
| 2 |
Name: platformdirs |
| 3 |
Version: 4.10.0 |
| 4 |
Summary: A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`. |
| 5 |
Project-URL: Changelog, https://platformdirs.readthedocs.io/en/latest/changelog.html |
| 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.10 |
| 21 |
Classifier: Programming Language :: Python :: 3.11 |
| 22 |
Classifier: Programming Language :: Python :: 3.12 |
| 23 |
Classifier: Programming Language :: Python :: 3.13 |
| 24 |
Classifier: Programming Language :: Python :: 3.14 |
| 25 |
Classifier: Programming Language :: Python :: Implementation :: CPython |
| 26 |
Classifier: Programming Language :: Python :: Implementation :: PyPy |
| 27 |
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
| 28 |
Requires-Python: >=3.10 |
| 29 |
Description-Content-Type: text/markdown |
| 30 |
|
| 31 |
# platformdirs |
| 32 |
|
| 33 |
[](https://badge.fury.io/py/platformdirs) |
| 34 |
[](https://pypi.python.org/pypi/platformdirs/) |
| 35 |
[](https://github.com/platformdirs/platformdirs/actions) |
| 36 |
[](https://pepy.tech/project/platformdirs) |
| 37 |
|
| 38 |
A Python package for determining platform-specific directories (e.g. user data, config, cache, logs). Handles the |
| 39 |
differences between macOS, Windows, Linux/Unix, and Android so you don't have to. |
| 40 |
|
| 41 |
## Quick start |
| 42 |
|
| 43 |
```python |
| 44 |
from platformdirs import PlatformDirs |
| 45 |
|
| 46 |
dirs = PlatformDirs("MyApp", "MyCompany") |
| 47 |
dirs.user_data_dir # ~/.local/share/MyApp (Linux) |
| 48 |
dirs.user_config_dir # ~/.config/MyApp (Linux) |
| 49 |
dirs.user_cache_dir # ~/.cache/MyApp (Linux) |
| 50 |
dirs.user_state_dir # ~/.local/state/MyApp (Linux) |
| 51 |
dirs.user_log_dir # ~/.local/state/MyApp/log (Linux) |
| 52 |
dirs.user_documents_dir # ~/Documents |
| 53 |
dirs.user_downloads_dir # ~/Downloads |
| 54 |
dirs.user_runtime_dir # /run/user/<uid>/MyApp (Linux) |
| 55 |
``` |
| 56 |
|
| 57 |
For Path objects instead of strings: |
| 58 |
|
| 59 |
```python |
| 60 |
from platformdirs import PlatformDirs |
| 61 |
|
| 62 |
dirs = PlatformDirs("MyApp", "MyCompany") |
| 63 |
dirs.user_data_path # pathlib.Path('~/.local/share/MyApp') |
| 64 |
dirs.user_config_path # pathlib.Path('~/.config/MyApp') |
| 65 |
``` |
| 66 |
|
| 67 |
Convenience functions for quick access: |
| 68 |
|
| 69 |
```python |
| 70 |
from platformdirs import user_data_dir, user_config_path |
| 71 |
|
| 72 |
user_data_dir("MyApp", "MyCompany") # returns str |
| 73 |
user_config_path("MyApp", "MyCompany") # returns pathlib.Path |
| 74 |
``` |
| 75 |
|
| 76 |
## Directory types |
| 77 |
|
| 78 |
**Application directories** — scoped to your app name and version: |
| 79 |
|
| 80 |
- **Data**: Persistent application data (`user_data_dir`, `site_data_dir`) |
| 81 |
- **Config**: Configuration files and settings (`user_config_dir`, `site_config_dir`) |
| 82 |
- **Preference**: User preferences, distinct from config on macOS (`user_preference_dir`) |
| 83 |
- **Cache**: Cached data that can be regenerated (`user_cache_dir`, `site_cache_dir`) |
| 84 |
- **State**: Non-essential runtime state like window positions (`user_state_dir`, `site_state_dir`) |
| 85 |
- **Logs**: Log files (`user_log_dir`, `site_log_dir`) |
| 86 |
- **Runtime**: Runtime files like sockets and PIDs (`user_runtime_dir`, `site_runtime_dir`) |
| 87 |
|
| 88 |
App dirs have both `user_*` (per-user, writable) and `site_*` (system-wide, read-only) variants where applicable. |
| 89 |
|
| 90 |
**User media directories** — standard user-facing folders, not scoped to app name: |
| 91 |
|
| 92 |
- **Documents** (`user_documents_dir`), **Downloads** (`user_downloads_dir`) |
| 93 |
- **Pictures** (`user_pictures_dir`), **Videos** (`user_videos_dir`), **Music** (`user_music_dir`) |
| 94 |
- **Desktop** (`user_desktop_dir`), **Projects** (`user_projects_dir`) |
| 95 |
- **Public share** (`user_publicshare_dir`), **Templates** (`user_templates_dir`) |
| 96 |
- **Fonts** (`user_fonts_dir`) — user-writable font installation directory |
| 97 |
- **Executable** (`user_bin_dir`, `site_bin_dir`), **Applications** (`user_applications_dir`, `site_applications_dir`) |
| 98 |
|
| 99 |
## Documentation |
| 100 |
|
| 101 |
Full documentation is available at [platformdirs.readthedocs.io](https://platformdirs.readthedocs.io): |
| 102 |
|
| 103 |
- **[Getting started tutorial](https://platformdirs.readthedocs.io/en/latest/tutorial.html)** -- learn core concepts |
| 104 |
through real-world examples |
| 105 |
- **[How-to guides](https://platformdirs.readthedocs.io/en/latest/howto.html)** -- recipes for common tasks and |
| 106 |
platform-specific tips |
| 107 |
- **[API reference](https://platformdirs.readthedocs.io/en/latest/api.html)** -- complete list of functions and classes |
| 108 |
- **[Platform details](https://platformdirs.readthedocs.io/en/latest/platforms.html)** -- default paths for each |
| 109 |
operating system |
| 110 |
|
| 111 |
Contributions are welcome! See [CONTRIBUTING.md](https://github.com/tox-dev/platformdirs/blob/main/CONTRIBUTING.md) for |
| 112 |
details. |