Configure cache directory with an environment variable
See original GitHub issueIs 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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Controlling cache dir with env variable · Issue #16 - GitHub
Issue In many cases it is useful to control the cache directory depending on the environment some tool/command is run in.
Read more >Set cache via environment variable - Getting Help - restic forum
Is there a way to set the cache directory via an environment variable? When working at the command line it is quite annoying...
Read more >Configuring pub environment variables - Dart
You can use the PUB_CACHE environment variable to specify another location. For more information, see The system package cache. PUB_HOSTED_URL: Pub downloads ...
Read more >Get cache location with env variable - npm - Stack Overflow
Short answer: It depends on when/how you want to access it, as there is no env variable, (e.g. NPM_CACHE_LOCATION ), available whilst npm...
Read more >Cache management - Hugging Face
The default cache directory is ~/.cache/huggingface/datasets . Change the cache location by setting the shell environment variable, HF_DATASETS_CACHE to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Close this since a workaround is provided.
PDM_CACHE_DIR=xxx pdm install
looks not so good to me. It breaks the centralized cache assumption andpdm cache
commands can’t manage them correctly.Oh, I see. Setting the HOME variable will actually allow PDM to create the
$HOME/.pdm
and$HOME/.cache/pdm
directories without a permission error. I’ll try that, thank you @frostming 🙂