Skip to content

stats, utils are Imports - #7897

Merged
MichaelChirico merged 1 commit into
masterfrom
base-imports
Sep 6, 2026
Merged

stats, utils are Imports#7897
MichaelChirico merged 1 commit into
masterfrom
base-imports

Conversation

@MichaelChirico

Copy link
Copy Markdown
Member

importFrom(utils, capture.output, contrib.url, download.file, flush.console, getS3method, head, packageVersion, tail, untar, unzip)

importFrom(stats, as.formula, na.omit, setNames, terms)

The importFrom() directives clearly mark these out as Imports IMO.

@jangorecki

Copy link
Copy Markdown
Member

If we go this route I would argue then we should have a job that runs tests with stats and utils not attached to the session, then we can actually test if those imports are properly (sufficiently) defined. If they wouldn't we should expect a NOTE, but still.

@MichaelChirico

Copy link
Copy Markdown
Member Author

R_DEFAULT_PACKAGES=null still wouldn't find this, you actually have to uninstall {stats} for it to cause any issue as of today (which is how I found it 😅)

Still, it should produce an R CMD check note, it's just that it's not enforced: https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Package-Dependencies

The ‘Imports’ field lists packages whose namespaces are imported from... Ideally this field will include all the standard packages that are used

@ben-schwen

Copy link
Copy Markdown
Member

The ‘Imports’ field lists packages whose namespaces are imported from... Ideally this field will include all the standard packages that are used

Apparently R Core members are really doing this see e.g. Matrix from Martin Maechler or slam from Kurt.

@MichaelChirico

Copy link
Copy Markdown
Member Author

We don't even need to go to package space, the packages are citing each other too, e.g. {stats}

https://github.com/r-devel/r-svn/blob/a43a1dec67bdba665ebf71e528e1c8a556f3c278/src/library/stats/DESCRIPTION.in#L10-L11

Imports: utils, grDevices, graphics
Suggests: MASS, Matrix, SuppDists, methods, stats4

@MichaelChirico
MichaelChirico merged commit 63ceb55 into master Sep 6, 2026
10 checks passed
@MichaelChirico
MichaelChirico deleted the base-imports branch September 6, 2026 07:37
mcol added a commit to R-Lum/Luminescence that referenced this pull request Sep 7, 2026
These are imported in NAMESPACE, so they should be listed in DESCRIPTION
too. At the moment, their inclusion is not enforced by CRAN, but this makes
us future-proof.

The inspiration for this came from:
   Rdatatable/data.table#7897

[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants