Repository navigation
fix: accept multipath in the site cache functions - #544
Merged
gaborbernat merged 5 commits intoSep 15, 2026
Merged
Conversation
Four site directories change with multipath: site_data_dir and site_config_dir on Unix and macOS, site_applications_dir on both, and site_cache_dir on macOS when the interpreter comes from Homebrew. The module-level functions expose the argument for the first three, but site_cache_dir() and site_cache_path() take no multipath at all, so passing it is a TypeError and the Homebrew cache prefix is unreachable from the function API. explanation.rst already documents the behaviour those functions cannot produce. Adding it keyword-only keeps opinion and ensure_exists where they are for positional callers, and matches how the applications functions took their new options. On site_cache_path it is a no-op, since the path variants return the first entry either way. Kept for the same reason site_data_path and site_config_path carry it: test_function_interface_is_in_sync requires the dir and path signatures to match. The new test parametrizes over the whole multipath family rather than just the cache case, so the next site directory that grows a multipath variant has to be reachable from its function too. Also corrects the multipath docstring in api.py, which still claimed only site_data_dir and site_config_dir were affected.
gaborbernat
approved these changes
Sep 15, 2026
gaborbernat
enabled auto-merge (squash)
September 15, 2026 21:51
gaborbernat
approved these changes
Sep 15, 2026
gaborbernat
added a commit
to gaborbernat/platformdirs
that referenced
this pull request
Sep 25, 2026
On Windows user_log_dir is a subdirectory of user_data_dir, and roaming=True moves that from AppData\Local to AppData\Roaming. The class honours the flag, but user_log_dir() and user_log_path() had no roaming argument, so they returned the Local log directory and raised TypeError when a caller passed roaming=True. Add roaming as a keyword-only argument after use_site_for_root, as tox-dev#537 and tox-dev#544 did for use_site_for_root and multipath, so the existing positional order stays intact.
gaborbernat
added a commit
to gaborbernat/platformdirs
that referenced
this pull request
Sep 25, 2026
On Windows user_log_dir is a subdirectory of user_data_dir, which a caller moves from AppData\Local to AppData\Roaming with roaming=True. PlatformDirs(roaming=True) returns the Roaming log directory, but user_log_dir() and user_log_path() had no roaming argument. Passing it raised TypeError, and function callers got the Local directory. Add roaming as a keyword-only argument after use_site_for_root, the placement tox-dev#537 and tox-dev#544 used, so positional callers see no change.
gaborbernat
added a commit
to gaborbernat/platformdirs
that referenced
this pull request
Sep 25, 2026
On Windows user_log_dir is a subdirectory of user_data_dir, which a caller moves from AppData\Local to AppData\Roaming with roaming=True. PlatformDirs(roaming=True) returns the Roaming log directory, but user_log_dir() and user_log_path() had no roaming argument. Passing it raised TypeError, and function callers got the Local directory. Add roaming as a keyword-only argument after use_site_for_root, the placement tox-dev#537 and tox-dev#544 used, so positional callers see no change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On macOS with Homebrew Python,
multipathadds the Homebrew prefix tosite_cache_dir.site_cache_dir()andsite_cache_path()did not accept the argument, so the function API could not return it:docs/explanation.rstdocuments the Homebrew prefix undermultipath=Trueforsite_cache_dir.Both functions take
multipathas a keyword-only argument afteropinionandensure_exists, as the applications functions did in #534 and #535.site_cache_pathreturns the first entry either way; it takes the argument becausetest_function_interface_is_in_syncrequires matching dir and path signatures.test_multipath_reaches_the_module_functioncompares the data, config, cache and applications functions withMacOSunder Homebrew Python, and fails if a function drops the argument or does not forward it. Themultipathdocstring inapi.pynow lists all four affected directories.