question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configure cache directory with an environment variable

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
frostmingcommented, May 21, 2021

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 and pdm cache commands can’t manage them correctly.

0reactions
pawamoycommented, May 6, 2021

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 🙂

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found