Can't prevent packrat throwing a warning for missing external packages
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 409
- Forks
- 89
- PR merge metrics
- No merged PRs in 30d
Description
I find Packrat a really good tool for managing dependancies and essential for using R in production where we need to ensure that our dependancies will be the same when something gets deployed.
A piece of functionality I believe to be missing is the ability to create different environments for development and production as there are certain packages (e.g. devtools) that are very useful to use in development but are quite heavy and totally redundant in production. Another example is the docstring package for being able to annotate functions with python like docstring. This is only useful for development but requires xml2 which requires the C library libxml-2.0, a dependancy we don't want to introduce into our production builds as it's not needed to run code.
I was of the understanding that the way to get round this was to mark these packages as external packages. This does work and allows these packages to be optionally installed locally if developers require it, however once introduced into the external.packages section of my packrat.opts, it means that any time R is run in this project on a system that doesn't have these packages installed locally you get the following error/warning:
Error in results[sapply(results, Negate(isTRUE))] :
invalid subscript type 'list'
In addition: Warning messages:
1: In FUN(X[[i]], ...) :
Package 'docstring' not available in repository or locally
2: In symlinkExternalPackages(project = project) :
The following external packages could not be located:
- 'docstring'
This isn't ideal - we want this package available when developing but similarly in our production builds we legitimately don't want this package to be there. However if I were to deploy this functionality this error/warning will now be present whenever R is run. I tried adding the package to ignored.packages but it doesn't make a difference.
I feel like I'm missing something here, is there anyway we can get these packages to be used if they are present locally or totally ignored if not? Or alternatively is there any other ways we can designate some packages as dev only and to be ignored by packrat?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the missing-external-package case through the external.packages and ignored.packages settings in packrat.opts, then inspect symlinkExternalPackages and the code that reports the shown error. Compare behavior when the package is installed locally versus absent. Done means development-only packages remain usable when present without producing an error or warning when absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100