-
-
Notifications
You must be signed in to change notification settings - Fork 81
Comparing changes
Open a pull request
base repository: tox-dev/platformdirs
base: 4.8.0
head repository: tox-dev/platformdirs
compare: 4.9.0
- 6 commits
- 21 files changed
- 3 contributors
Commits on Feb 14, 2026
-
📝 docs(usage): document use_site_for_root parameter (#439)
The `use_site_for_root` parameter was added in #426 but wasn't documented in the Usage Guide. 📚 Users had no way to discover this feature when configuring system services running as root that need to use system-wide directories instead of root's home directory. Added a dedicated section in the Usage Guide documenting `use_site_for_root` alongside other parameters like `ensure_exists`, `multipath`, and `roaming`. The documentation explains the Unix-only behavior, the default value for backwards compatibility, and includes a practical example showing how root processes redirect to site directories. Fixes #433
Configuration menu - View commit details
-
Copy full SHA for 03ccfd0 - Browse repository at this point
Copy the full SHA 03ccfd0View commit details -
🐛 fix(unix): use correct runtime dir path for OpenBSD (#440)
OpenBSD applications using platformdirs were unnecessarily falling back to temporary directories because the default runtime path `/var/run/user/{uid}` is not writable by regular users on OpenBSD. 🔒 This issue was reported by OpenBSD package maintainers who noticed the mismatch with the platform's native XDG implementation. OpenBSD now has native `XDG_RUNTIME_DIR` support in libc via the `setxdgenv()` function in [`lib/libc/gen/login_cap.c`](https://github.com/openbsd/src/blob/master/lib/libc/gen/login_cap.c), which creates directories at `/tmp/run/user/{uid}` with proper ownership and permissions. The fix splits the BSD platform detection to handle OpenBSD separately from FreeBSD and NetBSD, which both continue using `/var/run/user/{uid}`. ✨ This change aligns platformdirs with OpenBSD's official implementation while preserving existing behavior for FreeBSD and NetBSD. Applications on OpenBSD will now correctly use the runtime directory created by the system during login instead of falling back to temporary directories. ## Documentation References During investigation, the following official platform documentation was reviewed: - **OpenBSD**: [`setxdgenv()` in login_cap.c](https://github.com/openbsd/src/blob/master/lib/libc/gen/login_cap.c) - uses `/tmp/run/user/{uid}` - **FreeBSD**: [`pam_xdg` module](https://github.com/freebsd/freebsd-src/blob/main/lib/libpam/modules/pam_xdg/pam_xdg.c) - uses `/var/run/xdg/{username}` (platformdirs fallback of `/var/run/user/{uid}` is reasonable) - **NetBSD**: No native XDG support found; [pkgsrc patches](https://github.com/NetBSD/pkgsrc/blob/trunk/misc/py-platformdirs/patches/patch-tests_test__unix.py) treat it same as FreeBSD Fixes #436Configuration menu - View commit details
-
Copy full SHA for c69a552 - Browse repository at this point
Copy the full SHA c69a552View commit details -
✨ feat(api): add site_applications_dir property (#442)
Applications need to discover both user-specific and system-wide application directories for desktop integration. The library already provides `user_applications_dir` but lacked the corresponding site-level counterpart, creating an asymmetry with other directory pairs like `user_data_dir`/`site_data_dir`. This adds `site_applications_dir` following official platform conventions verified from documentation. 📂 On Linux it returns `/usr/share/applications` (via `$XDG_DATA_DIRS`), on macOS `/Applications`, on Windows `C:\ProgramData\Microsoft\Windows\Start Menu\Programs`, and on Android it aliases to `user_applications_dir` since there's no system-wide distinction. The implementation follows the established pattern of other `site_*_dir` properties with multipath support and respects the `use_site_for_root` option on Unix systems. ✨ This allows applications to properly discover where system-wide desktop entries and application shortcuts should be installed. **Platform documentation references:** - Windows: [CSIDL (Microsoft Learn)](https://learn.microsoft.com/en-us/windows/win32/shell/csidl) - `CSIDL_COMMON_PROGRAMS` - Linux: [XDG Base Directory Specification](http://specifications.freedesktop.org/basedir/latest/) - `$XDG_DATA_DIRS/applications` - macOS: [Apple File System Programming Guide](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html) - `/Applications` Closes #435
Configuration menu - View commit details
-
Copy full SHA for 7a47ac4 - Browse repository at this point
Copy the full SHA 7a47ac4View commit details -
✨ feat(api): add site_bin_dir property (#443)
Applications that install system-wide executables need a standard location that mirrors `user_bin_dir`. Currently, `user_bin_dir` provides `~/.local/bin` on Unix/macOS and `%LOCALAPPDATA%\Programs` on Windows, but there's no corresponding site-wide equivalent. This creates API inconsistency since all other directory types (data, config, cache, state, log, runtime) have both user and site variants. ✨ Package managers like Chocolatey, pip, and uv need a consistent answer for where to install system-wide binaries. The implementation follows platform conventions researched from official documentation. Unix/Linux uses `/usr/local/bin` per [FHS 3.0](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html), which designates this path for locally-installed software distinct from distribution packages in `/usr/bin`. macOS uses `/usr/local/bin` as the standard Homebrew and user installation location, since `/usr/bin` is read-only on modern macOS per [Apple's documentation](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html). Windows uses `%ProgramData%\bin` to mirror the `site_data_dir` pattern, following [Chocolatey's precedent](https://docs.chocolatey.org/en-us/choco/setup) of using `%ProgramData%\Chocolatey\bin` for system-wide package binaries. Android aliases to `user_bin_dir` since the platform has no system-wide installation concept per [Android's storage documentation](https://developer.android.com/guide/topics/data/data-storage). 🔍 The change also implements `use_site_for_root` support on Unix, allowing `user_bin_dir` to redirect to `site_bin_dir` when running as root. This matches the behavior of other `user_*` properties and provides a consistent experience for tools that need to install binaries differently based on privilege level. Closes #434
Configuration menu - View commit details
-
Copy full SHA for 816747e - Browse repository at this point
Copy the full SHA 816747eView commit details -
📚 docs: split usage guide into tutorial, how-to, and reference (#441)
The existing `usage.rst` documentation mixed tutorial content with reference material in a single 661-line file. New users looking to get started had to wade through parameter tables and edge cases, while experienced users searching for specific parameters had to scan through introductory examples. 📖 This made the documentation harder to navigate and maintain as the library evolved. The reorganization follows the [Divio documentation system](https://documentation.divio.com/) by splitting the content into three focused pages. `usage.rst` becomes a tutorial teaching core concepts through real-world examples from Black, Poetry, virtualenv, and tox. `howto.rst` provides recipes for common tasks like handling write errors and platform-specific considerations. `parameters.rst` serves as a reference for all configuration options including the previously undocumented `use_site_for_root` parameter. ✨ This structure lets users quickly find what they need based on their goal. All examples now use `_path` variants instead of `_dir` for consistency with modern Python practices. Real-world code examples link directly to source files in production projects so users can see how established tools use `platformdirs`. Closes #433 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for ae73d34 - Browse repository at this point
Copy the full SHA ae73d34View commit details -
Configuration menu - View commit details
-
Copy full SHA for 685a1d9 - Browse repository at this point
Copy the full SHA 685a1d9View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 4.8.0...4.9.0