ENH: Allow overriding user preferences directory with PSYCHOPY_CONFIG_FOLDER environment variable#7207
Conversation
…_FOLDER environment variable
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #7207 +/- ##
==========================================
- Coverage 12.28% 12.24% -0.04%
==========================================
Files 346 347 +1
Lines 64005 64349 +344
==========================================
+ Hits 7860 7882 +22
- Misses 56145 56467 +322
🚀 New features to boost your workflow:
|
|
I’ve already created a corresponding branch in psychopy_linux_installer that would work with this implementation of the config folder, if this PR is accepted: |
|
I would have preferred to add a |
|
@TEParsons @mdcutone this seems sensible to me (for other OSs as well as linux, actually) It would mean, for instance, that we can launch a psychopy process with a deliberately different set of preferences by setting that as an env var while launching the process |
This was my first thought too - I think it's workable still as the only thing I have an idea of how this could look so I'll submit a PR to your branch :) |
FF: Use call args rather than environment variable for setting custom prefs dir
|
Thanks for your help @TEParsons! However, with your version, the .psychopy3 folder is still being created in the home directory when PsychoPy starts, even when I specify a different directory using As it stands, the folder ends up being created in both locations. It seems like PsychoPy is still relying on the home directory for certain settings despite the |
|
Ah, I see what you mean... I was testing it by checking that Maybe rather than calling the two separately in |
|
I've updated the PR. It appears to be functioning correctly now. However, it still creates a |
|
I think that's okay :) It'll be creating the folder when initially importing the class, but so long as it doesn't use that folder when told not to it's fine for it to exist. |
This pull request changes
psychopy/preferences/preferences.pyto let users override PsychoPy’s config folder by settingPSYCHOPY_CONFIG_FOLDER. The new logic checks that the override exists and is readable/writable. It currently applies only to non‑Windows systems (it would be easy to enable on Windows, I’m just not sure if we want to). It works with:export PSYCHOPY_CONFIG_FOLDER=/path/to/config psychopybut the
monitorssubfolder still defaults to~/.psychopy3/monitors. The code doesn’t issue a message on invalid/succesfull overrides. Adding one could be a useful follow‑up.