Skip to content
Latchkey

uv tree: Show the Dependency Tree

uv tree renders the project dependency tree from uv.lock so you can see what pulls in what.

uv tree answers "why is this package installed?" by showing the resolved graph. It reads the lockfile, so it reflects exactly what uv sync would install.

What it does

uv tree displays the resolved dependency graph as an indented tree. --invert flips it so you start from a leaf and see what depends on it, which is how you trace why a transitive package is present.

Common usage

Terminal
uv tree
uv tree --depth 1
uv tree --package httpx
uv tree --invert --package certifi
uv tree --no-dev

Options

FlagWhat it does
--depth <n>Limit how deep the tree is printed
--package <name>Show the subtree for one package
--invertShow reverse dependencies (what needs this)
--no-devExclude the dev group from the tree
--outdatedAnnotate packages that have newer releases

In CI

uv tree --outdated is a lightweight way to surface stale dependencies in a scheduled job. Because it reads uv.lock without resolving, it is fast and deterministic; cache $UV_CACHE_DIR only matters if it has to fetch metadata for --outdated.

Common errors in CI

"error: Unable to find lockfile" means no uv.lock exists; run uv lock first. "error: Package <name> not found in the project environment" from --package means a typo or a package only present under a group you excluded. --outdated needs network access; behind a firewall it errors fetching index metadata.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →