✨ feat(windows): add WIN_PD_OVERRIDE_* env var overrides#428
Merged
gaborbernat merged 1 commit intotox-dev:mainfrom Feb 13, 2026
Merged
✨ feat(windows): add WIN_PD_OVERRIDE_* env var overrides#428gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat merged 1 commit intotox-dev:mainfrom
Conversation
On Windows the folder resolution (ctypes/registry) provides no way for users to redirect directories at runtime. This is needed when large data (ML models, package caches) should live on a different drive without changing the system-wide APPDATA/LOCALAPPDATA variables. Each CSIDL folder can now be overridden via a WIN_PD_OVERRIDE_ prefixed environment variable (e.g. WIN_PD_OVERRIDE_LOCAL_APPDATA), checked before falling back to the existing resolution. The lru_cache on get_win_folder is removed so overrides are picked up dynamically. Closes tox-dev#347
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 Windows the Shell Folder APIs (ctypes/registry) provide no mechanism for users to redirect directories at runtime. This matters when large data — ML models, package caches, build artifacts — should live on a different drive without changing the system-wide
APPDATA/LOCALAPPDATAvariables that every other application relies on. On Linux/macOSXDG_*variables solve this naturally, but Windows has no equivalent convention. Fixes #347.get_win_foldernow checks for aWIN_PD_OVERRIDE_*environment variable (e.g.WIN_PD_OVERRIDE_LOCAL_APPDATA) before falling back to the existing resolution. TheWIN_PD_OVERRIDE_prefix avoids colliding with real Windows variables while making it clear this is a platformdirs-specific override, and theWIN_prefix signals it only applies on Windows. The previouslru_cacheonget_win_folderis removed so overrides are picked up dynamically at each access.The platforms documentation now includes a full reference table of the nine supported override variables with an example showing how to redirect cache to a separate drive.