-
-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure cache directory with an environment variable #435
Comments
I need this even more now, because it turns out I can't even run |
I was able to work around this: export HOME=/tmp/home
mkdir -p $HOME
pdm config cache_dir /tmp/.pdm_cache It would definitely be easier to be able to do By the way, you should probably try to respect the XDG config instead of using |
I guess this single line would do the trick: export HOME=/tmp/home The config system is designed in a way that allows 3 levels of modification:
This is why only part of the config variables are available in the project or allow being overridden by env vars(refer to the table). And caches belong to the first category. Although users can persist the env vars across multiple runs, it is not recommended to do so. IMHO CI systems or workflows should be responsible for setting up the environment correctly to run scripts. Many tools have prerequisites, and the prerequisites of PDM is that it requires |
Oh, I see. Setting the HOME variable will actually allow PDM to create the |
Close this since a workaround is provided. |
Is your feature request related to a problem? Please describe.
In CI, my scripts run without a proper user set (no HOME), so the cache directory end up being
/.cache
, which triggers PermissionDenied errors. Looking at this table (which is absolutely fantastic to have, thanks), it seems that the cache directory, contrary to other settings, cannot be configured using an environment variable. Is there a reason for this? Maybe the docs simply don't state it while it exists?Currently the only option is to run
pdm config cache_dir /my/cache/directory
in each CI job.Describe the solution you'd like
Instead of having to run the pdm config command, I'd prefer configuring this with an environment variable, once and for all jobs.
The text was updated successfully, but these errors were encountered: