[R-pkg-devel] Handling Not-Always-Needed Dependencies?

Dirk Eddelbuettel edd at debian.org
Wed Aug 3 00:34:09 CEST 2016


On 2 August 2016 at 18:13, Duncan Murdoch wrote:
| Okay, now I think I understand, but I agree with CRAN.  It is not 
| feasible to tell if the test happened somewhere in the code unless we 
| enforce a particular way of writing the test.

Debian has well over 20k packages, and they are tested this way.  You just
need to show the will of testing in an _empty_ environment to ensure
_everything_ that is needed is loaded.
 
| I would object if I had to write if (requireNamespace("foo")) multiple 
| times just to satisfy CRAN's test, when any sane human could tell that 
| the first test was sufficient.
| 
| For example, if my package Suggests: foo, I should be able to write
| 
| if (!requireNamespace("foo"))
|    stop("Package foo is needed for this example")
| 
| and then merrily call foo::bar() as many times as I like.
| 
| Or am I still misunderstanding you?  What particular thing should CRAN 
| change?

You seem to misunderstand that both you and I want 

  if (!requireNamespace("foo"))
     stop("Package foo is needed for this example")

(or alternative per-call tests) and that CRAN does not enforce either.

CRAN, like Hadley, just closes its eyes, swallows hard, and then simply loads
everything treating Suggests as if it were Depends.

But it ain't. Suggests != Depends.

Now clearer?

Dirk, now bored of this and it is clearly not going anywhere soon

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



More information about the R-package-devel mailing list