Skip to content

[Query] Guess Dependency Versions

github-actions[bot] edited this page Nov 8, 2026 · 1 revision

Generated from 'wiki-query.ts' on 2026-11-08, 11:35:56 UTC (v2.17.4), do not edit directly.

Guess Dependency Versions Query [overview]

Guesses the version range each dependency must have, from declared constraints and actual code usage.
This query is requested with the type guess-dep-versions.
Run in the REPL: :query @guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--disabled <letters>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>

A script rarely says which version of a package it needs, but it shows you. If it passes an argument that a function only gained in some release, it cannot run on anything older. This query turns that observation into a concrete version range per dependency.

It combines two sources of evidence:

  1. what the project declares: a DESCRIPTION range, an rproject.toml entry, a lockfile pin, and everything these imply transitively, and
  2. what the code does: which package functions it calls and with which arguments, matched against the signature database.

Every resulting bound carries its provenance, so the answer explains itself: each entry lists the evidence that produced it, naming the function, the parameter, and the bound it implies.

Two things can raise a lower bound: calling a function that did not exist yet, or passing an argument that the function only gained later. Consider a script calling dplyr::across:

library(dplyr)
mutate(mtcars, across(everything(), round))

across was only introduced in dplyr 1.0.0, so the script cannot run on anything older. The result names the function that produced the bound:

[ { "type": "guess-dep-versions" } ]

(This can be shortened to @guess-dep-versions when used with the REPL command :query).

Show Results

Results (prettified and summarized):

Query: guess-dep-versions (311 ms)
   ╰ R 4.5.3 (config)
   evidence: d declared t transitive s signature D date b base-r # available i indirect
   ▶ sample (newest): base@4.5.3, tidyselect@1.2.1 (works with all newest versions)
     runnable combinations: 0 (0.0%)
   ━ base [base] >=0.62.1 <=4.5.3 (136/136 versions, db 0.62.1 - 4.5.3)
      b <=4.5.3 bounded by R 4.5.3
   ━ dplyr ***** (0/47 versions, db 0.1 - 1.2.1)
      s >=1.0.0 across (new, at 2:16)
      s >=0.5.0 <=0.7.4 everything (new, at 2:23)
   ━ tidyselect [orphan: attach library(tidyselect) for everything] >=1.2.0 <=1.2.1 (2/13 versions, db 0.1.1 - 1.2.1)
      ! everything() at 2:23 resolves to no definition (most downloaded of 3)
      or instead: poorman >=0.1.10 <=0.2.7, rfoaas >=0.0.4 <=2.3.3
      t >=1.2.0 required by dplyr 1.2.1

Show Detailed Results as Json

The analysis ran (including parsing and normalization and the query) within the generation environment.

The JSON contains the ids of the nodes in question (see the Interface wiki page).

{"guess-dep-versions":{".meta":{},"dependencies":[{"package":"base","base":true,"declaredConstraints":[],"range":">=0.62.1 <=4.5.3","minVersion":"0.62.1","maxVersion":"4.5.3","candidateCount":136,"totalVersions":136,"constrained":false,"candidates":["0.62.1","0.62.2","0.62.3","0.62.4","0.63.1","0.63.2","0.63.3","0.64.0","0.64.1","0.64.2","0.65.0","0.65.1","0.90.0","0.90.1","0.99.0","0.99.0a"],"truncated":true,"evidence":[{"source":"available","origin":"signature database","detail":"data available from 0.62.1","bound":">=0.62.1"},{"source":"available","origin":"signature database","detail":"data available up to 4.5.3","bound":"<=4.5.3"},{"source":"base-r","origin":"R 4.5.3","detail":"base package bounded by R 4.5.3","bound":"<=4.5.3"}],"used":true},{"package":"dplyr","base":false,"declaredConstraints":[],"range":"*","candidateCount":0,"totalVersions":47,"evidence":[{"source":"available","origin":"signature database","detail":"data available from 0.1","bound":">=0.1"},{"source":"available","origin":"signature database","detail":"data available up to 1.2.1","bound":"<=1.2.1"},{"source":"signature","origin":"dplyr::everything","detail":"dplyr::everything exists only from 0.5.0","bound":">=0.5.0","function":"dplyr::everything","at":9,"location":"2:23"},{"source":"signature","origin":"dplyr::everything","detail":"dplyr::everything removed after 0.7.4","bound":"<=0.7.4","function":"dplyr::everything","at":9,"location":"2:23"},{"source":"signature","origin":"dplyr::across","detail":"dplyr::across exists only from 1.0.0","bound":">=1.0.0","function":"dplyr::across","at":13,"location":"2:16"}],"used":true},{"package":"tidyselect","base":false,"declaredConstraints":[],"range":">=1.2.0 <=1.2.1","minVersion":"1.2.0","maxVersion":"1.2.1","candidateCount":2,"totalVersions":13,"candidates":["1.2.0","1.2.1"],"evidence":[{"source":"available","origin":"signature database","detail":"data available from 0.1.1","bound":">=0.1.1"},{"source":"available","origin":"signature database","detail":"data available up to 1.2.1","bound":"<=1.2.1"},{"source":"transitive","origin":"dplyr 1.2.1","detail":"dplyr 1.2.1 requires tidyselect >= 1.2.0","bound":">= 1.2.0"}],"orphan":true,"orphanFunctions":["everything"],"orphanEvidence":[{"function":"everything","location":"2:23","reason":"most downloaded","exporters":3}],"orphanAlternatives":[{"package":"poorman","range":">=0.1.10 <=0.2.7","minVersion":"0.1.10","maxVersion":"0.2.7","candidateCount":10,"totalVersions":11},{"package":"rfoaas","range":">=0.0.4 <=2.3.3","minVersion":"0.0.4","maxVersion":"2.3.3","candidateCount":16,"totalVersions":16}],"used":true}],"rVersion":"4.5.3","rVersionOrigin":"config","versionSelection":"newest","runnableCombinations":0,"possibleCombinations":611},".meta":{}}

The guess can be narrowed further:

  • packages restricts it to the dependencies you care about,
  • date caps every guess to releases available at that point in time (YYYY.MM.DD, also YYYY or YYYY.MM),
  • clean ignores the declared constraints entirely and guesses purely from usage,
  • disabled excludes individual evidence sources by name (repl: --disabled followed by their one-letter codes shown in the legend below, e.g. --disabled ds drops declared and signature),
  • maxCandidates caps how many candidate versions are listed per dependency,
  • maxIterations bounds the two fixpoint loops (packages constrain each other, so the guess is iterated until it settles), and
  • explode additionally enumerates concrete version combinations (order, prefer, and limit control which and how many).

Packages can also be tied to one shared version (the base/R packages always are), and solver.versionManagement.linkedVersionGroups declares further groups. Such a package reports its partners in linkedWith, because its range is then no longer independent of theirs.

What one dependency requires of another (transitive evidence) is read from every version of it still in play:

  • all of them require it: the guess is narrowed, by the weakest of their bounds,
  • only some do: the evidence carries partial: true and never narrows, as another version avoids it.

A partial requirement still ties the two together. A 0.2.5 needing B 0.2.1 and A 0.3.0 needing B 0.3.2 shrinks neither range, yet the versions are not free. Each package lists its coupledWith partners, and runnableCombinations counts the tuples those couplings admit, against the plain product possibleCombinations and, where the project declares constraints, against declaredCombinations (what those alone leave, so the share says how much the guess added).

Note

This query needs the signature database, and specifically a database carrying the history of a package, since bounding a version means comparing releases. Without one it returns no guesses and says so in its message. See the Signature Query to inspect the signatures the guess is drawn from.

Implementation Details

The Guess Dependency Versions Query is executed by executeGuessDepVersionsQuery.

Clone this wiki locally

⌂ 换网址