[R-pkg-devel] How to account for optional packages not necessarily on CRAN
Dirk Eddelbuettel
edd @end|ng |rom deb|@n@org
Wed Dec 11 02:52:32 CET 2019
On 10 December 2019 at 17:22, Balasubramanian Narasimhan wrote:
| We've run into the following problem in integrating commercial and open
| source solvers in to our package CVXR. We have "Suggests" dependency on
| some packages that may not be available to CRAN.
|
| There are two main scenarios.
|
| 1. A suggested meta-package is on CRAN, e.g. Rmosek, but the user must
| further take action to ensure the binary is installed. The recommended
| requireNamespace("Rmosek", quietly = TRUE) is insufficient to guarantee
| the functionality desired even if it succeeds.
|
| 2. A suggested package is on github or a commercial vendor site only.
| The package code has references to such packages in the code, causing
| problems while checking on CRAN.
|
| It would seem, at least for 2 above, that separating the suggested
| functionality into other packages can ensure that birds of the same
| feather can flock together. But the shared internals make this
| impossible to do at the moment.
|
| The only thing I can think of is to ask CRAN to consider
| _R_FORCE_CHECK_SUGGESTS_= 0 for such a package. Am I missing anything?
You could use drat (or, if you prefer, roll a CRAN repo by hand) to host a
"CRAN-alike" repo on, say, GitHub or any other http(s)-accessible site, and
then use Additional_repository: with it.
Brooke and I have a fully worked in example for the case of large data
packages in the R Journal:
https://journal.r-project.org/archive/2017/RJ-2017-026/index.html
Hosting Data Packages via drat: A Case Study with Hurricane Exposure Data
G. Brooke Anderson and Dirk Eddelbuettel , The R Journal (2017) 9:1, pages
486-497.
Abstract Data-only packages offer a way to provide extended functionality
for other R users. However, such packages can be large enough to exceed
the package size limit (5 megabytes) for the Comprehen sive R Archive
Network (CRAN). As an alternative, large data packages can be posted to
additional repostiories beyond CRAN itself in a way that allows smaller
code packages on CRAN to access and use the data. The drat package
facilitates creation and use of such alternative repositories and makes it
particularly simple to host them via GitHub. CRAN packages can draw on
packages posted to drat repositories through the use of the
‘Additonal_repositories’ field in the DESCRIPTION file. This paper
describes how R users can create a suite of coordinated packages, in which
larger data packages are hosted in an alternative repository created with
drat, while a smaller code package that interacts with this data is
created that can be submitted to CRAN.
Don't be misled by 'data' here--it works the same way with code. And it is
the _one_ option you have because Suggests: are not required to be on a
primary repo like CRAN or BioC. Naturally, you then need to condition your
code on "is it here yet?" but you likely already do.
Hope this helps, Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the R-package-devel
mailing list