rstudio / pins-r

Pin, Discover and Share Resources
https://pins.rstudio.com
Other
301 stars 62 forks source link

Add new `PINS_CACHE_PATH` env var, plus documentation #748

Closed juliasilge closed 1 year ago

juliasilge commented 1 year ago

Closes #747

With these changes, we can now use an environment variable to specify where the cache goes:

withr::local_envvar(list("PINS_CACHE_PATH" = "~/Desktop"))
server <- pins:::rsc_server(auth = "envvar")
pins::board_cache_path(paste0("connect-", rlang::hash(server$url)))
#> ~/Desktop/connect-31a399613ac85efda77ffe6ff20c105a

Created on 2023-06-02 with reprex v2.0.2

This also finally fixes #611 by documenting how the env variables work, with some advice on a read-only filesystem like AWS Lambda.

machow commented 1 year ago

I just double checked in pins-python, and apparently it uses PINS_CACHE_DIR as an optional env var for overriding the cache directory. (I don't think this is documented, and probably exists for unit tests..). May be useful to change here or there to match env vars?

https://github.com/rstudio/pins-python/blob/7ded06943c6ea3236e5da4443a3869073d66aeb1/pins/config.py#L8

juliasilge commented 1 year ago

Thanks to both!

@machow I changed the env var here so it matches what pins for Python has. 👍

github-actions[bot] commented 1 year ago

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.