Skip to content

Encourage Imports not Depends #3076

Open

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.

Package Host Last Upload Issue? PR/Patch? Fixed in dev
1 DiSCos CRAN 2026-07-12 ✅ ✅
2 KMD CRAN 2026-07-09 ✉️: 2026-08-19
3 unvs.med CRAN 2026-06-30 ✉️: 2026-08-19
4 OmicFlow CRAN 2026-05-19 ✅ 2026-06-25
5 poissonsuperlearner CRAN 2026-05-18 ✅ 2026-08-19
6 CoSMoS CRAN 2026-05-07 ✅ ✅
7 pep725 CRAN 2026-04-24 ✅ 2026-07-25
8 RapidoPGS CRAN 2026-04-03 ✅ ✅ 2026-08-20
9 circhelp CRAN 2026-04-02 ✅ 2024-09-04
10 rMIDAS CRAN 2026-03-13 ✅ ✅
11 didimputation CRAN 2026-03-09 ✅ 2026-08-18
12 partools CRAN 2026-02-06 ✅ ✅
13 rTLS CRAN 2026-01-19 ✅ ✅
14 normfluodbf CRAN 2025-10-10 ✅ ✅
15 tma CRAN 2025-09-19 ✉️: 2026-08-19
16 colocPropTest CRAN 2025-09-16 ✅ ✅
17 FORD CRAN 2025-05-30 ✅ ✅
18 damr CRAN 2025-04-21 ✅ ✅
19 behavr CRAN 2025-03-27 ✅ ✅
20 HospitalNetwork CRAN 2024-12-22 ✅ 2025-07-08
21 ZIM4rv CRAN 2024-12-19 ✅ ✅
22 lori CRAN 2024-11-18 ✅
23 SOMnmR CRAN 2024-07-04 ✅ ✅
24 LKT CRAN 2024-07-01 ✅ ✅
25 SeaVal CRAN 2024-06-14 ✅ ✅
26 limexhub CRAN 2024-05-06 ✅ ✅
27 rblt CRAN 2024-02-19 ✅ ✅
28 nosoi CRAN 2024-02-09 ✅ 2025-07-11
29 tablecompare CRAN 2023-11-14 ✅ ✉️: 2026-08-19
30 sqlHelpers CRAN 2023-10-14 ✉️: 2026-08-19
31 PreProcessRecordLinkage CRAN 2023-09-13 ✉️: 2026-08-19
32 fplyr CRAN 2023-08-23 ✅ ✅
33 IBRtools CRAN 2023-08-14 ✅ ✅ 2026-08-19
34 TrumpetPlots CRAN 2023-06-13 ✅ ✅
35 DiDforBigData CRAN 2023-04-03 ✅ ✅
36 pgTools CRAN 2023-03-24 ✅ ✅
38 libbib CRAN 2022-11-05 ✅ ✅
39 mind CRAN 2022-10-27 ✉️: 2026-08-19
40 acdcR CRAN 2022-06-27 ✅ ✅
41 chicane CRAN 2021-11-06 ✉️: 2026-08-19
42 FeatureImpCluster CRAN 2021-10-20 ✅ ✅
43 edl CRAN 2021-09-20 ✉️: 2026-08-19
44 ZIprop CRAN 2021-06-09 ✉️: 2026-08-19
45 FOCI CRAN 2021-03-18 ✉️: 2026-08-19
46 shinyML CRAN 2021-02-24 ✅ ✅
47 textTools CRAN 2021-02-05 ✉️: 2026-08-19
48 dbWebForms CRAN 2021-01-28 ✉️: 2026-08-19
49 classifierplots CRAN 2020-10-13 ✅
50 intervalaverage CRAN 2020-07-23 ✅ ✅
51 LSPFP CRAN 2020-05-13 ✉️: 2026-08-19
52 eyeTrackR CRAN 2020-03-29 ✉️: 2026-08-19
53 birankr CRAN 2020-03-23 ✅ ✅
54 GenomicTools.fileHandler CRAN 2020-03-05 ✅ ✅
55 gdxdt CRAN 2019-11-30 ✉️: 2026-08-19
56 cdparcoord CRAN 2019-08-04 ✅ ✅
57 twl CRAN 2018-08-24 ✉️: 2026-08-19
58 RWildbook CRAN 2018-04-06 ✉️: 2026-08-19
59 miLineage CRAN 2018-03-23 ✉️: 2026-08-19
60 Ac3net CRAN 2018-02-26 ✉️: 2026-08-19
61 bea.R CRAN 2018-02-23 ✅
62 heims CRAN 2018-01-25 ✅ ✅
64 orgR CRAN 2014-12-20 ✅ ✅
65 Chicago Bioconductor 2026-04-28 ✅ ✅
66 GOTHiC Bioconductor 2026-04-28 ✉️: 2026-08-19
67 GladiaTOX Bioconductor 2026-04-28 ✅ ✅
68 HMMcopy Bioconductor 2026-04-28 ✅ ✅
69 ModCon Bioconductor 2026-04-28 ✅ 2026-07-16
70 RCAS Bioconductor 2026-04-28 ✅ ✅
71 TIN Bioconductor 2026-04-28 ✉️: 2026-08-19
72 chimeraviz Bioconductor 2026-04-28 ✅ 2026-08-18
73 deconvR Bioconductor 2026-04-28 2025-07-13
74 methrix Bioconductor 2026-04-28 ✅ 2025-12-01
75 rBiopaxParser Bioconductor 2026-04-28 ✅ ✅
76 sangeranalyseR Bioconductor 2026-04-28 ✅ 2026-05-05
77 SNPhood Bioconductor 2025-11-04 ✉️: 2026-08-19
Repro script to re-generate this table
library(tools)
library(data.table)

# 1. Fetch CRAN metadata and reverse dependencies (Depends: data.table)
cran_db = as.data.table(CRAN_package_db())
cran_deps = package_dependencies("data.table", db = as.matrix(cran_db), reverse = TRUE, which = "Depends")$data.table
cran_sub = cran_db[Package %in% cran_deps]

# 2. Fetch Bioconductor metadata and reverse dependencies (Depends: data.table)
bioc_views_url = "https://bioconductor.org/packages/release/bioc/VIEWS"
tf = tempfile()
download.file(bioc_views_url, tf, quiet = TRUE)
bioc_views = as.data.table(read.dcf(tf))
bioc_deps = package_dependencies("data.table", db = as.matrix(bioc_views), reverse = TRUE, which = "Depends")$data.table
bioc_sub = bioc_views[Package %in% bioc_deps]

# 3. Harvest existing tracked links dynamically from GitHub issue #3076 body
issue_body = tryCatch({
  res = httr::GET("https://api.github.com/repos/Rdatatable/data.table/issues/3076", httr::user_agent("Rdatatable"))
  httr::content(res, "parsed")$body
}, error = function(e) "")

known_links = list()
fixed_links = list()
lines = strsplit(issue_body, "\r?\n")[[1]]

for (l in lines) {
  # Parse table rows: | # | [pkg](repo) | [Host](host_url) | Last Upload | [✅](issue) | [✅](pr) | [date](fix) |
  if (grepl(r"{^\|.*\|.*\|.*\|}", l)) {
    parts = strsplit(l, "\\|")[[1]]
    if (length(parts) > 0 && parts[1] == "") parts = parts[-1]
    parts = trimws(parts)
    if (length(parts) >= 4 && !any(grepl("Last Upload|:---", parts))) {
      pkg_col = if (grepl("^[0-9]+$", parts[1])) 2 else 1
      pkg = sub(r"{^\[([^]]+)\].*}", "\\1", parts[pkg_col])
      
      issue_col = pkg_col + 3
      pr_col    = pkg_col + 4
      fix_col   = pkg_col + 5
      
      if (length(parts) >= issue_col && grepl(r"{https?://}", parts[issue_col])) {
        m_iss = regmatches(parts[issue_col], regexec(r"{\((https?://[^)]+)\)}", parts[issue_col]))[[1]]
        if (length(m_iss) > 1) {
          known_links[[length(known_links) + 1]] = data.table(Package = pkg, Type = "Issue", URL = m_iss[2])
        }
      }
      if (length(parts) >= pr_col && grepl(r"{https?://}", parts[pr_col])) {
        m_pr = regmatches(parts[pr_col], regexec(r"{\((https?://[^)]+)\)}", parts[pr_col]))[[1]]
        if (length(m_pr) > 1) {
          known_links[[length(known_links) + 1]] = data.table(Package = pkg, Type = "PR", URL = m_pr[2])
        }
      }
      if (length(parts) >= fix_col && grepl(r"{https?://}", parts[fix_col])) {
        fixed_links[[length(fixed_links) + 1]] = data.table(Package = pkg, Fixed_In_Dev = parts[fix_col])
      }
    }
  }
}

links_dt = if (length(known_links) > 0) {
  dcast(unique(rbindlist(known_links)), Package ~ Type, value.var = "URL", fun.aggregate = function(x) x[1])
} else {
  data.table(Package = character(), Issue = character(), PR = character())
}

fixed_dt = if (length(fixed_links) > 0) unique(rbindlist(fixed_links)) else data.table(Package = character(), Fixed_In_Dev = character())

# Helper: extract source forge repository (GitHub/GitLab) from package fields or links
extract_repo <- function(pkg, url_fields, issue_url, pr_url) {
  ref_url = na.omit(c(issue_url, pr_url))
  if (length(ref_url) > 0) {
    m = regmatches(ref_url[1], regexec(r"{(https?://[^/]+/[^/]+/[^/#?]+)}", ref_url[1]))[[1]]
    if (length(m) > 1) {
      repo = sub(r"{/(issues|pull|tree|blob|commit)/?.*$}", "", m[2])
      repo = sub(r"{/-/issues/?.*$}", "", repo)
      return(repo)
    }
  }
  urls = unlist(strsplit(url_fields[!is.na(url_fields)], "[,\n\t ]+"))
  urls = urls[urls != ""]
  repo_urls = grep("git(hub|lab)", urls, value = TRUE)
  repo_urls = repo_urls[!grepl("\\.github\\.io", repo_urls)]
  if (length(repo_urls) > 0) {
    m = regmatches(repo_urls[1], regexec(r"{(https?://[^/]+/[^/]+/[^/#?]+)}", repo_urls[1]))[[1]]
    if (length(m) > 1) {
      repo = sub(r"{\.git$}", "", m[2])
      repo = sub(r"{/(issues|pull)/?.*$}", "", repo)
      repo = sub(r"{/-/issues/?.*$}", "", repo)
      return(repo)
    }
  }
  NA_character_
}

# CRAN data
cran_dt = data.table(
  Package_Name = cran_sub$Package,
  Host_Name = "CRAN",
  Host_URL = sprintf("https://cran.r-project.org/package=%s", cran_sub$Package),
  Last_Upload = as.character(as.Date(as.POSIXct(cran_sub[["Date/Publication"]]))),
  URL_Fields = paste(cran_sub$URL, cran_sub$BugReports, sep = ", ")
)

# Bioconductor data
bioc_dt = data.table(
  Package_Name = bioc_sub$Package,
  Host_Name = "Bioconductor",
  Host_URL = sprintf("https://bioconductor.org/packages/%s", bioc_sub$Package),
  Last_Upload = bioc_sub[["Date/Publication"]],
  URL_Fields = paste(bioc_sub$URL, bioc_sub$BugReports, bioc_sub$git_url, sep = ", ")
)

all_pkgs = rbind(cran_dt, bioc_dt)
all_pkgs = merge(all_pkgs, links_dt, by.x = "Package_Name", by.y = "Package", all.x = TRUE)
all_pkgs = merge(all_pkgs, fixed_dt, by.x = "Package_Name", by.y = "Package", all.x = TRUE)

all_pkgs[, Repo := mapply(extract_repo, Package_Name, URL_Fields, Issue, PR)]
all_pkgs[, Package := ifelse(!is.na(Repo) & Repo != "", sprintf("[%s](%s)", Package_Name, Repo), Package_Name)]
all_pkgs[, Host := sprintf("[%s](%s)", Host_Name, Host_URL)]
all_pkgs[, `Issue?` := ifelse(!is.na(Issue) & Issue != "", sprintf("[✅](%s)", Issue), "")]
all_pkgs[, `PR?` := ifelse(!is.na(PR) & PR != "", sprintf("[✅](%s)", PR), "")]
all_pkgs[, `Fixed in dev` := ifelse(!is.na(Fixed_In_Dev), Fixed_In_Dev, "")]

# Sort by Host (CRAN then Bioconductor) and descending Last_Upload
all_pkgs[, Host_Order := factor(Host_Name, levels = c("CRAN", "Bioconductor"))]
setorder(all_pkgs, Host_Order, -Last_Upload)

# Leftmost column numbered 1...n with empty header
all_pkgs[, ` ` := .I]

out_dt = all_pkgs[, .(` `, Package, Host, `Last Upload` = Last_Upload, `Issue?`, `PR?`, `Fixed in dev`)]
writeLines(knitr::kable(out_dt, format = "markdown", align = c("r", "l", "l", "l", "c", "c", "l")))

Activity

  1. added this to the 1.12.0 milestone on Sep 26, 2018
  2. jangorecki commented on Sep 27, 2018

    @jangorecki
    Member

    It shouldn't be disallowed because there are valid use cases for Depends, for example my package dtq which is a logging mechanism for [.data.table. I recall other package too: dt.nuggets(?). We should definitely recommend to imports instead of depends, but IMO it should not be disallowed as there are valid use cases for Depends.

  3. mattdowle commented on Sep 27, 2018

    @mattdowle
    MemberAuthor

    Fair enough. Why exactly is it that those packages need Depends and can't use Imports?

  4. jangorecki commented on Sep 28, 2018

    @jangorecki
    Member

    They are extensions of data.table, their existence without data.table is pointless. They not just "use" data.table.

  5. mattdowle commented on Sep 28, 2018

    @mattdowle
    MemberAuthor

    I still don't follow. Importing is as strong as depending in that imports are required. No package importing data.table can install without it. What would fail if they changed to Imports? There is also Enhances:.
    Does dtq mask [.data.table so it need to be attached in front of data.table on the search path?

  6. jangorecki commented on Sep 30, 2018

    @jangorecki
    Member

    It is as strong, except the fact that imported namespace doesn't need to be attached. It doesn't mask, but it expects data.table to be attached. There are definitely very few use cases like this so general rule should be to import.
    In case of listed rev deps that depends on data.table we could propose to change that to imports. Change might need to update examples and unit tests (thus all dependent scripts too) to require data.table explicitly together with such rev dep package, which is potentially significant breaking change, still easy to fix.
    Regarding change of depends to imports of Rbitcoin rev dep, I am not maintaining this package anymore. It might eventually be incompatible with later versions of data.table or exchange market APIs, I have no idea. Latest CRAN release is 4+ years old, dev version is 2+ years old. If someone is willing to take maintenance of it then it will be best, otherwise it will probably gets removed from CRAN once it will start breaking to many newly added rules.

  7. modified the milestones: 1.12.0, 1.12.2 on Jan 11, 2019
  8. mattdowle commented on Feb 27, 2019

    @mattdowle
    Author
  9. modified the milestones: 1.12.2, 1.12.4 on Feb 27, 2019
  10. changed the title [-]Disallow `Depends:`; require `Imports:` only.[/-] [+]Encourage Imports not Depends[/+] on Feb 27, 2019
  11. mbannert commented on Feb 27, 2019

    @mbannert

    First of all thanks a ton for reaching out to the package maintainers.

    I fully agree. I always use data.table for my backends and have imported on my more recent packages. In my case panelaggregation was a try to put a package on CRAN back when people wore pyjamas and lived life slow. Last time a data.table change caused issues I tried to get the package of CRAN but was discouraged to do so. I'd rather put my time into my newer packages than to fix a package which is more or less abandoned. On the other hand it would probably not be that much of deal to fix it though I haven't looked at the package in years.

    Bottom line: from my point of view, disallowing would be a bit too much since it would get my old package of CRAN forcefully.

  12. tdhock commented on Feb 27, 2019

    @tdhock
    Member

    hi I just updated my penaltyLearning package, tdhock/penaltyLearning@ef8e7fb. now it imports data.table instead of depends. basically I just had to add a bunch of library(data.table) lines in tests and examples.

  13. bozenne commented on Feb 28, 2019

    @bozenne

    Hi thanks for the email and for data.table
    I have also changed to imports in the Github version of the BuyseTest package.
    Will be updated on CRAN at some point.

    Best
    brice

  14. 19 remaining items

  15. modified the milestones: 1.14.3, on Jul 19, 2022
  16. mattdowle commented on Oct 31, 2022

    @mattdowle
    Author
  17. modified the milestones: , 1.15.1 on Oct 29, 2023
  18. modified the milestones: 1.16.0, 1.17.0 on Jul 10, 2024
  19. modified the milestones: 1.17.0, 1.18.0 on Dec 11, 2024
  20. modified the milestones: 1.18.0, 1.19.0 on Nov 17, 2025
  21. MichaelChirico commented on Aug 19, 2026

    @MichaelChirico
    Member

    I used Gemini to file migration PRs against all public downstreams; I condensed that into a depends-to-imports SKILL: https://github.com/MichaelChirico/r-skills/blob/main/r-depends-to-imports/SKILL.md

    I think that once 1.19.0 is released, we can begin to deprecate support for Depends downstreams in {data.table} to finally force this into practice.

  22. modified the milestones: 1.19.0, 1.20.0 on Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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