[R-pkg-devel] Should 'methods' be in Imports?
Noah Greifer
no@h@gre||er @end|ng |rom gm@||@com
Thu Mar 16 16:29:33 CET 2023
Hello developers,
I am wondering if base packages whose functions are used in my package need
to be present in Imports in my DESCRIPTION. For example, if I use the
function abline(), which exists in the *graphics* package, do I need to
include *graphics* in Imports? Note I am not asking about whether I need to
import all or any function from the *graphics* package, that is, assume I
am using graphics::abline(), etc. I am solely asking about the DESCRIPTION
file, not the Namespace.
I ask because there seems to be some ambiguity about this. I received a
pull request from someone adding *methods* to my Imports after noticing I
didn't declare it when using a function from *methods* (accessed in my
package using ::). Looking on StackOverflow, there seems to be confusion
about this. The most relevant question I could find was this one
<https://stackoverflow.com/q/39439006/6348551>. The question was marked as
a duplicate despite the linked duplicate being separate from it (i.e.,
asking about the Namespace, not the DESCRIPTION). Similarly, the answer to
the question does not address the question, again referring to the
Namespace and making an irrelevant distinction between Depends and Imports.
Some of the comments reference a CRAN policy, and yet that policy does not
seem to be implemented since many packages (including all of mine) omit the
base packages from the DESCRIPTION.
So, is it optional to include these packages in the DESCRIPTION? I see some
packages do so and some don't. Is including these packages filling the
DESCRIPTION with unnecessary dependencies that are automatically satisfied,
or is it being helpfully explicit about the packages your package relies
on? Thanks.
Noah
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list