|
| 1 | +Dependency tree of a project |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +Show everything an R project needs, directly or indirectly, as a tree, so you |
| 6 | +can see *how* each package is pulled in and not only *that* it is. |
| 7 | + |
| 8 | +This is the same set of packages that |
| 9 | +[`rig proj deps --recursive`](#rig-proj-deps) lists in a flat table, laid out by |
| 10 | +the shape of the dependency graph instead. Use `--json` for machine readable |
| 11 | +output, as one nested object. |
| 12 | + |
| 13 | +``` |
| 14 | +myproject 0.1.0 — 3 direct, 24 total |
| 15 | +├── R (>= 4.1) [D] |
| 16 | +├── cli 3.6.4 |
| 17 | +│ ├── R (>= 3.4) [D] |
| 18 | +│ └── utils |
| 19 | +└── dplyr 1.1.4 (>= 1.1.0) |
| 20 | + ├── cli 3.6.4 (>= 3.4.0) (*) |
| 21 | + └── vctrs 0.6.5 (>= 0.6.4) |
| 22 | + └── cpp11 0.5.2 [L] |
| 23 | +[Suggests] |
| 24 | +└── testthat 3.2.3 (>= 3.1.5) |
| 25 | +``` |
| 26 | + |
| 27 | +The first line names the project and its version, how many dependencies it |
| 28 | +declares directly, and how many distinct packages there are in the whole tree. |
| 29 | +Each line below it names a package, the version currently in the repositories, |
| 30 | +and the version requirement it is needed with, if it has one. |
| 31 | + |
| 32 | +By default rig reads the project manifest (e.g. `DESCRIPTION`) in the current |
| 33 | +directory; use `--input` to point to a different file. Unlike the plain |
| 34 | +[`rig proj deps`](#rig-proj-deps) listing, the tree needs the package metadata |
| 35 | +of the repositories, which rig downloads if it does not have it yet. It does |
| 36 | +not need R. |
| 37 | + |
| 38 | +## Reading the tree |
| 39 | + |
| 40 | +A package that several others need is expanded only once, under the first |
| 41 | +place it appears; later occurrences are a single line marked `(*)`, meaning |
| 42 | +"its dependencies are above". That is also what makes dependency cycles end on |
| 43 | +their own. |
| 44 | + |
| 45 | +`--dev` adds the project's development dependencies, `Suggests` and `Enhances`, |
| 46 | +in their own `[Suggests]` and `[Enhances]` sections. As in `rig proj deps`, |
| 47 | +`--dev` applies to the project only: below a development dependency rig still |
| 48 | +follows hard dependencies only. `--no-base` leaves out R and the base packages |
| 49 | +altogether, which is much less to read if you only care about what would have |
| 50 | +to be installed. A package that is not in the repositories at all is shown with |
| 51 | +`?` for its version. |
| 52 | + |
| 53 | +Among the hard dependencies, `Imports` is the common case and is not marked; |
| 54 | +`[D]` is a `Depends`, `[L]` a `LinkingTo`, `[DL]` both. |
| 55 | +[`rig pkg tree`](pkg.qmd#rig-pkg-tree), which shows the same tree for a package |
| 56 | +in the repositories, describes all of this in full. |
| 57 | + |
| 58 | +rig follows the dependencies of the *latest* version of every package in the |
| 59 | +tree, so a version requirement that would force an older version, with |
| 60 | +different dependencies, is not taken into account. Use |
| 61 | +[`rig proj solve`](#rig-proj-solve) for a resolution that is consistent across |
| 62 | +versions. |
0 commit comments