Sometimes you just want to know about your dependencies, and their dependencies.
I’ve been using pipdeptree for a while, but recently switched to uv pip tree.
Let’s take a look at both tools.
pipdeptree
pipdeptree is pip installable, but I don’t want pipdeptree itself to be reported alongside everything else installed, so I usually install it outside of a project. We can use it system wide by:
- Installing with
uv tool install pipdeptree.- Then running with
pipdeptree --python auto
- Then running with
- Running without installing with
uvx pipdeptree --python auto
usage
The --python auto tells pipdeptree to look at the current environment.
Let’s take a look at the dependencies in my cards project:
(cards) $ pipdeptree --python auto
(resolved python: /Users/brianokken/projects/cards/.venv/bin/python)
cards==2.0.0
├── tinydb [required: ==4.8.2, installed: 4.8.2]
├── typer [required: ==0.17.4, installed: 0.17.4]
│ ├── click [required: >=8.0.0, installed: 8.3.0]
│ ├── typing_extensions [required: >=3.7.4.3, installed: 4.15.0]
│ ├── shellingham [required: >=1.3.0, installed: 1.5.4]
│ └── rich [required: >=10.11.0, installed: 14.1.0]
│ ├── markdown-it-py [required: >=2.2.0, installed: 4.0.0]
│ │ └── mdurl [required: ~=0.1, installed: 0.1.2]
│ └── Pygments [required: >=2.13.0,<3.0.0, installed: 2.19.2]
└── rich [required: ==14.1.0, installed: 14.1.0]
├── markdown-it-py [required: >=2.2.0, installed: 4.0.0]
│ └── mdurl [required: ~=0.1, installed: 0.1.2]
└── Pygments [required: >=2.13.0,<3.0.0, installed: 2.19.2]
The tree structure makes it super easy to see what’s installed and why.
prerequisites
To get this to work right, I needed to have my project installed in a virtual environment:
$ git clone https://github.com/okken/cards.git
$ cd cards
$ uv venv .venv --prompt .
$ source .venv/bin/activate
(cards) $ uv pip install -e .
uv pip tree
uv has a similar feature with uv pip tree.
In the same cards directory:
(cards) $ uv pip tree
cards v2.0.0
├── rich v14.1.0
│ ├── markdown-it-py v4.0.0
│ │ └── mdurl v0.1.2
│ └── pygments v2.19.2
├── tinydb v4.8.2
└── typer v0.17.4
├── click v8.3.0
├── rich v14.1.0 (*)
├── shellingham v1.5.4
└── typing-extensions v4.15.0
(*) Package tree already displayed
Show version specifiers
By default, uv pip tree doesn’t list the rules, but we can turn those on.
(cards) $ uv pip tree --show-version-specifiers
cards v2.0.0
├── rich v14.1.0 [required: ==14.1.0]
│ ├── markdown-it-py v4.0.0 [required: >=2.2.0]
│ │ └── mdurl v0.1.2 [required: ~=0.1]
│ └── pygments v2.19.2 [required: >=2.13.0, <3.0.0]
├── tinydb v4.8.2 [required: ==4.8.2]
└── typer v0.17.4 [required: ==0.17.4]
├── click v8.3.0 [required: >=8.0.0]
├── rich v14.1.0 [required: >=10.11.0] (*)
├── shellingham v1.5.4 [required: >=1.3.0]
└── typing-extensions v4.15.0 [required: >=3.7.4.3]
(*) Package tree already displayed
Finding outdated packages
Another of my favorite features is --outdated.
(cards) $ uv pip tree --show-version-specifiers --outdated
cards v2.0.0
├── rich v14.1.0 [required: ==14.1.0] (latest: v14.2.0)
│ ├── markdown-it-py v4.0.0 [required: >=2.2.0]
│ │ └── mdurl v0.1.2 [required: ~=0.1]
│ └── pygments v2.19.2 [required: >=2.13.0, <3.0.0]
├── tinydb v4.8.2 [required: ==4.8.2]
└── typer v0.17.4 [required: ==0.17.4] (latest: v0.20.0)
├── click v8.3.0 [required: >=8.0.0]
├── rich v14.1.0 [required: >=10.11.0] (*)
├── shellingham v1.5.4 [required: >=1.3.0]
└── typing-extensions v4.15.0 [required: >=3.7.4.3]
(*) Package tree already displayed
Looks like I need to update the project with an updated rich and typer.
explore more features
Both projects do more than I’ve shown. Remember to check out the docs for each and run --help on each.
Links: