Direct and Transitive Build Dependencies

A dependency declared by the project is direct. Other packages reached through its requirements are transitive dependencies.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace one dependency chain
  2. Declare interfaces you use directly
  3. Draw both paths that introduce a shared library
  4. Check package use independently from installation visibility

Trace one dependency chain

An app requires a chart library, and the chart library requires a font parser. The font parser still affects the runtime artifact. This is a reachability question over the resolved dependency graph.

Declare interfaces you use directly

If the app imports the parser itself, relying exclusively on the chart library to install it can fail after a chart update. Explicitly declare the app's use and review the lockfile for the selected graph.[1]

Draw both paths that introduce a shared library

An application declares A and B. A uses C. B also uses C with a distinct version constraint. Upgrading A can therefore change what versions of C the resolver can select. The application's own declaration may not mention C at all. See declared and resolved constraints.

Direct edges: app→A and app→B
Transitive paths: app→A→C and app→B→C
A changed constraint can affect C and callers through both paths

Check package use independently from installation visibility

Code can accidentally import a transitive dependency and rely on it being present. If the app intentionally uses that dependency, declare it according to ecosystem guidance. Test in a clean environment where incidental packages are absent.

References

  1. Free Software Foundation, GNU Make Manual ↩