cmu-delphi / epidatr

Delphi Epidata API R Client
https://cmu-delphi.github.io/epidatr/
Other
1 stars 5 forks source link

fix: make default cache directory R version portable #248

Closed dshemetov closed 6 months ago

dshemetov commented 6 months ago

Use rappdirs::user_cache_dir("R", version = "epidatr") instead of tools::R_user_dir("epidatr") (previous discussion).

Also informs the user of the cache and its variables when its used, e.g.:

! epidatr cache is being used (set env var EPIDATR_USE_CACHE=FALSE if not intended).
ℹ The cache directory is ~/.cache/R/epidatr.
ℹ The cache will be cleared after 1 days and will be pruned if it exceeds 1024 MB.
ℹ The log of cache transactions is stored at ~/.cache/R/epidatr/logfile.txt.
dshemetov commented 6 months ago

Up to us if we want to possibly bump against the CRAN policy here just to understand that paragraph you linked better / what their enforcement is like in practice. A strict interpretation doesn't make sense, since that would mean any sort of function that writes a file to a user-specified path is not allowed, and that's not the case. I don't see how someone calling set_cache to write files is that much different. Gabor Csardi (r-lib maintainer) pointed out on the mailing list in 2018 that this policy goes against industry standards.

Or I could just close this PR. The existing solution is fine and compliant with CRAN.

dsweber2 commented 6 months ago

If this is the only thing holding us back from enabling <4 R versions I would merge and let the CRAN reviewers give it the evil eye if they actually don't like it. They may have just neglected to mention it. Functionally equivalent means it should be fine

dshemetov commented 6 months ago

Sounds good, I will merge the other PR first and make sure this one is the last one, so we can revert it easily in case the evil eye befalls us.