Skip to content

Encourage Imports not Depends #3076

@mattdowle

Description

@mattdowle

CRAN + BioC: Depends Imports


I've only recently realized how bad Depends: is, thanks to Jan's importing vignette. I just made its discouragement stronger : 51590bc

We could disallow Depends. This would also be beneficial to cedta()'s awkward implementation on its last line where it needs to do the tryCatch just for packages which Depend; that line could be removed.

But before we disallow Depends, we'd need to ask 69 CRAN packages to change from Depends to Imports. (Most revdeps already Import.) The longer we leave it, the greater the potential for new packages using Depends to be added to CRAN and the harder it will be to change.

Check when changed to Imports and published:

CRAN


Bioconductor

Details

More metadata on these packages: CRAN links, version control links. Sorted by recent publish date to prioritize those that are actively maintained.

Package Last CRAN Update Version GH URL
dbi.table 2024-12-10 1.0.1 GH
opendataformat 2024-12-04 2.1.1 GH
lori 2024-11-18 2.2.3 GH
CBRT 2024-11-13 0.1.1 GH
rcprd 2024-11-13 0.0.1
rusquant 2024-09-16 1.1.4 GH
solaR2 2024-09-16 0.10 GH
mpactr 2024-09-10 0.1.0 GH
DiSCos 2024-07-23 0.1.1 GH
circhelp 2024-07-04 1.1 GH
SOMnmR 2024-07-04 0.3.0 GH
LKT 2024-07-01 1.7.0
SeaVal 2024-06-14 1.2.0 GH
colocPropTest 2024-06-11 0.9.1
qreport 2024-05-26 1.0-1
EGM 2024-05-23 0.1.0
limexhub 2024-05-06 0.1.5
immunarch 2024-03-18 0.9.1 GH
cffdrs 2024-02-22 1.9.0
rblt 2024-02-19 0.2.4.7 GH
nosoi 2024-02-09 1.1.2 GH
reclin2 2024-02-09 0.5.0 GH
metaforest 2024-01-26 0.1.4
coveffectsplot 2024-01-18 1.0.5 GH
cellKey 2023-11-24 1.0.2 GH
tablecompare 2023-11-14 0.1.1 GH
sqlHelpers 2023-10-14 0.1.2
rMIDAS 2023-10-11 1.0.0 GH
WebAnalytics 2023-10-04 0.9.12 GH
PreProcessRecordLinkage 2023-09-13 1.0.1
robCompositions 2023-08-25 2.4.1
fplot 2023-08-24 1.1.0
fplyr 2023-08-23 1.3.0 GH
microseq 2023-08-21 2.1.6
IBRtools 2023-08-14 0.1.3
TrumpetPlots 2023-06-13 0.0.1.1
somspace 2023-04-28 1.2.4
DiDforBigData 2023-04-03 1.0 GH
pgTools 2023-03-24 1.0.2 GH
HospitalNetwork 2023-02-27 0.9.3 GH
bdots 2023-01-06 1.2.5 GH
rasterDT 2022-12-15 0.3.2 GH
libbib 2022-11-05 1.6.4
KMD 2022-10-06 0.1.0
KPC 2022-10-05 0.1.2
didimputation 2022-08-25 0.3.0
acdcR 2022-06-27 1.0.0 GH
chicane 2021-11-06 0.1.8
FeatureImpCluster 2021-10-20 0.1.5
edl 2021-09-20 1.1
ZIprop 2021-06-09 0.1.1 GL
CoSMoS 2021-05-29 2.1.0 GH
twangRDC 2021-05-17 1.0
FOCI 2021-03-18 0.1.3
shinyML 2021-02-24 1.0.1 GH
textTools 2021-02-05 0.1.0
dbWebForms 2021-01-28 0.1.0
damr 2020-11-16 0.3.7 GH
classifierplots 2020-10-13 1.4.0 GH
EBPRS 2020-08-26 2.1.0
intervalaverage 2020-07-23 0.8.0
HPLB 2020-06-09 1.0.0
LSPFP 2020-05-13 1.0.3
eyeTrackR 2020-03-29 1.0.1
birankr 2020-03-23 1.0.1
GenomicTools.fileHandler 2020-03-05 0.1.5.9
nlpred 2020-02-23 1.0.1
gdxdt 2019-11-30 0.1.0
WGScan 2019-05-27 0.1
AF 2019-05-20 0.1.5
word.alignment 2019-04-15 1.1
behavr 2019-01-03 0.3.2 GH
GenoScan 2018-12-21 0.1
pkggraph 2018-11-15 0.2.3 GH
twl 2018-08-24 1.0
easycsv 2018-05-21 1.0.8 GH
RWildbook 2018-04-06 0.9.3
dfmeta 2018-03-27 1.0.0
miLineage 2018-03-23 2.1
Ac3net 2018-02-26 1.2.2
bea.R 2018-02-23 1.0.6
reinsureR 2018-02-20 0.1.0
heims 2018-01-25 0.4.0
slim 2017-05-15 0.1.1
gbp 2017-01-28 0.1.0.4 GH
skm 2017-01-23 0.1.5.4 GH
panelaggregation 2017-01-07 0.1.1
RSauceLabs 2016-09-27 0.1.6 GH
musica 2016-09-03 0.1.3
lookupTable 2015-08-28 0.1
orgR 2014-12-20 0.9.0

These packages had previously used Depends: data.table but either no longer do, or were removed from CRAN:

List as code for easier maintenance of this list:

library(httr)
library(tools)
library(data.table)

if (requireNamespace("devtools", quietly=TRUE) && requireNamespace("BiocManager", quietly=TRUE)) {
  cran_depends = devtools::revdep('data.table', 'Depends')
  bioc_depends = devtools::revdep('data.table', 'Depends', bioconductor = TRUE)
} else {
  cran_depends = package_dependencies("data.table", reverse=TRUE, which="Depends")$data.table

  bioc_vr = '3.20'
  bioc_db = available.packages(repos = file.path('http://bioconductor.org/packages', bioc_vr, 'bioc'))
  bioc_depends = package_dependencies("data.table", bioc_db, reverse=TRUE, which="Depends")$data.table
}

desc_data <- function(package) {
  repo = getOption('repos')["CRAN"]
  desc_url <- file.path(repo, "web", "packages", package, "DESCRIPTION")
  desc_file <- httr::content(httr::GET(desc_url), encoding = "UTF-8")
  desc_conn <- rawConnection(desc_file, open = "r")
  on.exit(close(desc_conn))

  # based on very exhaustive GitHub CRAN mirror search of DESCRIPTION files
  url_fields = c("URL", "URLNote", "BugReports", "Github")
  desc = read.dcf(desc_conn, c("Package", "Date/Publication", "Version", url_fields))
  repo_regex = ".*git(?:hub|lab)[a-zA-Z0-9._]+/([A-Za-z0-9._]+/[A-Za-z0-9._]+).*"
  url = desc[,url_fields] |>
    Filter(f = Negate(is.na)) |>
    strsplit(",") |>
    lapply(function(str) {
      repo_like = grep(repo_regex, str, value=TRUE)
      repo_like = grep("github.io", repo_like, value=TRUE, invert=TRUE)
      gsub("/issues", "", trimws(repo_like))
    }) |>
    unlist() |>
    unique()

  out = data.table(
    package = desc[,"Package"],
    published_date = as.Date(as.POSIXct(desc[,"Date/Publication"])),
    version = desc[,"Version"])
  if (!length(url)) url = NA_character_
  if (length(url) > 1L) {
    # e.g. cellKey has a special BugReports repo
    url = grep(package, url, fixed=TRUE, value=TRUE)
    if (length(url) > 1L) stop("found more than one apparent URL for ", package)
  }
  out[, url := url]
  out[]
}

cran_depends = rbindlist(lapply(cran_depends, desc_data))

writeLines(paste("- [ ]", cran_depends$package))

cran_depends[, package := sprintf('[%1$s](https://cran.r-project.org/web/packages/%1$s/index.html)', package)]
cran_depends[, url := fcase(
  grepl("github", url), sprintf("[GH](%s)", url),
  grepl("gitlab", url), sprintf("[GL](%s)", url),
  !is.na(url), url
)]

setorder(cran_depends, -published_date)
setnames(cran_depends, c("Package", "Last CRAN Update", "Version", "URL"))
options(knitr.kable.NA = '')
knitr::kable(cran_depends)

writeLines(sprintf("- [ ] [%1$s](https://www.bioconductor.org/packages/%2$s/bioc/html/%1$s.html)", bioc_depends, bioc_vr))

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeissues whose solution would require breaking existing behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions