[R-pkg-devel] nit-picking about CRAN repository policy
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Sun May 8 01:17:32 CEST 2022
On 07/05/2022 6:43 p.m., Ben Bolker wrote:
>
> Folks,
>
> CRAN has recently set up an auxiliary 'noSuggests' test platform that
> tests that packages are using suggested packages conditionally, as
> recommended in Writing R Extensions, and as (sort of) specified in the
> CRAN repository policy.
>
> Specifically, the CRP (revision 5236) says:
>
> > A package listed in ‘Suggests’ or ‘Enhances’ should be used
> conditionally in examples or tests if it cannot straightforwardly be
> installed on the major R platforms. (‘Writing R Extensions’ recommends
> that they are always used conditionally.)
>
> One of my packages failed on the 'noSuggest' test platform
> <https://www.stats.ox.ac.uk/pub/bdr/noSuggests/bbmle.out> because two
> suggested packages were used unconditionally in the vignette. There are
> two reasons (IMO) that this should *not* have triggered a threat of
> archiving:
>
> (1) the unconditional package use was in a vignette, not in examples
> or tests
> (2) the relevant packages (AICcmodavg and MuMIn) are available on
> CRAN and install easily on Linux/Windows/MacOS (they are R-only, no
> compiled code or extra requirements, binaries are available on CRAN).
>
> Is it worth suggesting to CRAN maintainers that either they refine
> their 'noSuggests' test so that it conforms to the wording in the CRP,
> or that they change the CRP wording to something stricter like
>
> > Any package listed in ‘Suggests’ or ‘Enhances’ should be used
> conditionally in examples, tests, and vignettes.
I wouldn't think it's worth the time, but you could submit a suggested
patch to them if you feel like it.
Personally I'd take a more extreme position than theirs: your package
should check without errors if any subset of the Suggests packages is
installed. This isn't practical to test, but "all" and "none" is at
least something.
With vignette formats based on knitr, it's very easy to implement this.
Just add a code chunk at the beginning with code like this:
if (!requireNamespace("sug1") ||
!requireNamespace("sug2")) {
warning(call. = FALSE, "This vignette requires sug1 and sug2 to be
installed")
knitr::knit_exit()
}
I don't know if other vignette engines make it so easy to bail out, but
they should.
Duncan Murdoch
More information about the R-package-devel
mailing list