Skip to content

[R-pkg-devel] dependency cycle

2 messages · Berry Boessenkool, Dirk Eddelbuettel

#
Hi,

I have a package A. Some of its functions are used in package B.

B imports A in the DESCRIPTION, both are on CRAN.

A has a function fff where I want to add some optional functionality.

The problem: that optional stuff uses code in package B.


I feel like I have two bad options:

- put fff in a package C that imports both A and B.
However, C would really be too small to be on CRAN.
Also, some people already know of A::fff and I'm rather inclined to keep it there.

- put B in Suggests and make the optional part of fff conditional on requireNamespace("B").

But then B imports A while A suggests B, which sounds dangerous.


Any ideas on what I could/should do here?

Thanks ahead,

Berry
#
On 13 June 2017 at 13:01, Berry Boessenkool wrote:
| 
| Hi,
| 
| I have a package A. Some of its functions are used in package B.
| 
| B imports A in the DESCRIPTION, both are on CRAN.
| 
| A has a function fff where I want to add some optional functionality.
| 
| The problem: that optional stuff uses code in package B.
| 
| 
| I feel like I have two bad options:
| 
| - put fff in a package C that imports both A and B.
| However, C would really be too small to be on CRAN.
| Also, some people already know of A::fff and I'm rather inclined to keep it there.
| 
| - put B in Suggests and make the optional part of fff conditional on requireNamespace("B").
| 
| But then B imports A while A suggests B, which sounds dangerous.
| 
| 
| Any ideas on what I could/should do here?

My Google-Fu is weak this morning but I think we just that discussion here.

Usual tip: Disentangle.  Create package C with common code.  Have A use
it. Have B use A.  No cycles.

Dirk