klmr / box

Write reusable, composable and modular R code
https://klmr.me/box/
MIT License
829 stars 47 forks source link

Add transitive package dependency discovery support for ‘renv’ #368

Open klmr opened 1 week ago

klmr commented 1 week ago

Please describe your feature request

‘renv’ already supports box::use() declarations for dependency discovery via static analysis.

However, this misses all package dependencies declared inside modules that are imported via box::use(), in particular non-local modules (local modules would presumably be searched by ‘renv’ anyway). Adding support for the discovery of transitive package dependencies declared inside modules used by a project to ‘renv’ should be feasible, but would require more complex static analysis, in combination with a reimplementation of the module finding algorithm used by ‘box’.

A better solution would be for ‘box’ to expose supporting infrastructure that could be invoked by ‘renv’. This is kind of “safe”, since a ‘renv’ project that uses ‘box’ presumably has ‘box’ installed anyway, so ‘renv’ could soft-depend on it (via Enhances; or it might not even need that?).