0

I have an R package A and a package B. The package B genuinely depends on A for some of its functions. The package A depends on B, but only for testing. So the package dependency is not genuinely circular.

The travis build fails for A because upon installing A it tries to install B only to find A is not installed.

How can I tell travis not to worry about B until it starts testing?

My thoughts are to:

  • Put all of B's dependencies in A, leaving B independent.
  • Leave off the dependency of A on B, and construct the test as if B didn't exist.

But both seem as drastic as abandoning unit testing.

I've mocked up an minimum reproducible example:

https://github.com/HughParsonage/AAAA

https://github.com/HughParsonage/BBBB

When I push AAAA to travis, I get:

ERROR: dependency ‘AAAA’ is not available for package ‘BBBB’

removing ‘/usr/local/lib/R/site-library/BBBB’

Error: Command failed (1)

Execution halted

My actual packages are

A: https://github.com/HughParsonage/grattan

B: https://github.com/HughParsonage/taxstats

Hugh
  • 15,521
  • 12
  • 57
  • 100

1 Answers1

1

I suspect you know the answer to this: Just avoid the circular dependency.

There just was an insightful and detailed discussion about a very related situation on the r-devel list in this thread. You a look at the discussion there; several options were proposed and the original poster was somewhat convinced -- just like you here -- that the standard laws of gravity would not apply to them.

I would just avoid the problem and put the commonalities into a new package pkgC upon which pkgA and pkgB can depend, or even just suggest it. Another simply solution (also proposed in the thread) is to just merge pkgA and pkgB.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 3
    Dirk, do you have to live quite so relentlessly in the real world? – Hugh Apr 11 '16 at 01:22
  • Note also that for CRAN packages, submitting two co-dependent packages (whether suggest or otherwise) simultaneously, with a note to the CRAN maintainers is acceptable. https://stat.ethz.ch/pipermail/bioc-devel/2015-October/008098.html and https://stat.ethz.ch/pipermail/r-devel/2013-March/066063.html – Jack Wasey Mar 20 '19 at 18:06