Dependency Resolution on One Page

When someone installs your package, their package manager has to turn a pile of version ranges into one concrete set of files. Each ecosystem does this differently, and those differences decide whether your users end up with one copy of a dependency or three. Below, the essentials are laid out as labelled blocks, each written so it could stand as the caption of a panel in a printed infographic.

Panel 1: inputs and outputs

Input: declared ranges. Your manifest says what you accept, such as "lodash": "^4.17.0" or requests>=2.28,<3. A range is a promise about compatibility, not a pin.
Output: a resolved graph. The installer picks exactly one version (or, in npm's case, possibly several) of every package and records the result, usually in a lockfile.

Alt-text description: two boxes side by side, an arrow from "ranges you write" on the left to "exact versions installed" on the right, with the label "resolver" on the arrow.

Panel 2: four strategies, four outcomes

EcosystemHow it picksCopies of one package
npm and similar Node.js managersHighest version satisfying each range; nested node_modules when ranges conflict.Several versions can coexist in one install.
pipBacktracking resolver seeks one version of each package that satisfies every requirement.One per environment; conflicts are errors.
Go modulesMinimal version selection: the lowest version that meets every module's stated minimum.One per major version; a new major is a different module path.
CargoHighest compatible version per semver-compatible range, unified where possible.One per semver-incompatible range; two majors may coexist.

Alt-text description: a four-row grid, each row a small tree diagram; the npm row shows a branch with two differently coloured copies of the same package, the pip row shows a single copy with a red "conflict" badge on an alternative branch.

Panel 3: what this means for library authors

Panel 4: the lockfile in one sentence

A lockfile records what was resolved last time, so the next install on another machine gets the same answer until someone asks for a change.

Examples include package-lock.json, pnpm-lock.yaml, Cargo.lock and go.sum; note that go.sum holds checksums rather than choices, since go.mod already determines the versions. For a fuller explanation, see the annotated npm dependency tree tutorial and the guide to peer dependencies.