[R-pkg-devel] PkgA imports PkgB, and PkgB suggests PkgA?

Shu Fai Cheung @hu|@|@cheung @end|ng |rom gm@||@com
Sat Nov 4 13:45:30 CET 2023


Many many thanks for the clarification, which is very clear! The case
of testthat is a very good example, as many packages suggest it.

Regards,
Shu Fai


On Sat, Nov 4, 2023 at 4:41 PM Iñaki Ucar <iucar using fedoraproject.org> wrote:
>
>
>
> El sáb., 4 nov. 2023 5:43, Shu Fai Cheung <shufai.cheung using gmail.com> escribió:
>>
>> Hi All,
>>
>> I vaguely recall that, on CRAN, if PkgA imports PkgB, then PkgB cannot
>> import PkgA. (Please correct me if I am wrong.)
>>
>> How about this?
>>
>> PkgA imports PkgB (because PkgA has some helper functions for using PkgB)
>> PkgB suggests PkgA (because some vignettes or examples in PkgB use
>> those helpers from PkgA)
>
>
> Or some tests are based on PkgA, or...
>
>> Is this allowed on CRAN?
>
>
> Yes, it is. For example: testthat imports a bunch of packages to do is thing, and those packages suggest testthat because their test suite is based on it.
>
> Cycles of hard dependencies (Depends, Imports) are not allowed for obvious reasons. But packages should install and work without soft dependencies, so there's no problem there.
>
> Iñaki



More information about the R-package-devel mailing list