On Sun, Feb 25, 2018 at 1:41 AM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 24/02/2018 7:26 PM, Marius Hofert wrote: >> On Sun, Feb 25, 2018 at 1:09 AM, Dirk Eddelbuettel <e...@debian.org> wrote: >>> >>> On 25 February 2018 at 00:45, Marius Hofert wrote: >>> | A package 'foo' uses a package 'bar' (in Imports). 'bar' has been >>> | archived and the maintainer of 'foo' was asked to fix the dependency >>> | on 'bar' according to WRE 1.1.3.1. >>> | >>> | Working with 'bar::' everywhere (and requireNamespace("bar", quietly = >>> | TRUE)), as well as moving 'bar' from Imports to Suggests seems to work >>> | but is not accepted on submission. Removing 'bar' also from Suggests >>> | leads to >>> | >>> | '::' or ':::' import not declared from: ‘bar’ >>> | 'loadNamespace' or 'requireNamespace' call not declared from: ‘bar’ >>> | >>> | Does this mean it is not possible to use 'bar' anymore in 'foo'? >>> >>> Your title says "conditionally". >>> >>> Does your code actually behave conditionally, ie does foo check if bar is >>> available, and only use its code if it is? >> >> Hi Dirk, >> >> nice to hear from you and thanks for helping! >> >> Yes, 'foo' essentially has one main function with an argument 'method >> = c("b", "ba", "bar")'. If the user chooses to call the function with >> method = "bar", then it is checked whether "bar" is installed (as >> described in WRE) and an error is thrown if not. > > Don't throw an error, work around it.
Hi, the 'workaround' is the error: to tell the user not to use it (but one of the other available methods). To be more precise: 'bar' is the package 'loon' for dynamic graphics (and 'foo' is 'zenplots'). If that's not installed, the user can choose to work with the other (non-dynamic) graphics packages. If a user actively chooses to do the plotting with loon but doesn't have loon installed, the error is a logical consequence. > If you have no alternative code, > then don't test the "bar" code unless "bar" is installed. The main plotting function in zenplots uses: if(pkg == "loon" && !requireNamespace("loon", quietly = TRUE)) stop("Package 'loon' is not available.") ... and if it's installed, it will call various further functions from loon (now all used via "loon::..."). There are no tests or examples that fail, everything works -- it's just that the use of "::" generates the warning I mentioned which is (most likely) unacceptable for upload to CRAN. > > The basic idea is that your package should pass tests without errors > even if "bar" is not available. It does -- except for the 'warning': '::' or ':::' import not declared from: ‘bar’ 'loadNamespace' or 'requireNamespace' call not declared from: ‘bar’ > > I think Dirk is wrong saying that "bar" has to be available; CRAN isn't > going to go looking for it. But they do want your package to pass all > tests even if none of the Suggests packages is available. 'loon' is not in Suggests. It originally was in 'Imports', then I put it to 'Suggests', but when I submitted, Uwe wrote: But you still have Suggests: loon, Please fix and resubmit. ... so it shouldn't appear in 'Suggests' either (I guess). That's why I also removed it from Suggests, but then (because of the above warning), I can't submit either. Not sure how to solve this (... and thought that others might have a similar problem with archived packages -- thus this post). Cheers, Marius > > Duncan Murdoch > >> >>> >>> One additional difficulty may be that even for Suggests, it still has to be >>> accessible "somewhere" . >> >> The full story is this: 'bar' has been archived because 'problems were >> not corrected despite reminders'. 'bar' is mainly developed on github >> and is probably easy to fix, but I also couldn't reach the maintainer >> and I thought it's better to 'decrease' the dependency on 'bar' as >> much as possible. 'bar' is actually quite intrusive to install/use >> (requires R to be configured with tcltk). However, 'bar' provides some >> nice features which the other methods ("b", "ba") don't have -- would >> be a pity to completely remove 'bar' from 'foo'. >> >> So 'bar' is on github (and thus could be installed from there + 'foo' >> could make use of 'bar' conditionally... just don't know how to submit >> 'foo' to CRAN because of the warning) >> >> Cheers, >> M >> >> >> >>> And "archived" is not. You could just move bar >>> onto a drat repo you set yp -- we have done the same for data packages and >>> have a R Journal paper describing it: >>> >>> https://journal.r-project.org/archive/2017/RJ-2017-026/index.html >>> >>> Hth, Dirk >>> >>> -- >>> http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org >> >> ______________________________________________ >> R-package-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-package-devel >> > ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel