In my project, which I manage with uv
, some transitive dependency is restricting numpy to numpy==2.0
; even though the newest version is numpy=2.2
.
Is there any convenient way to make uv
tell me what the cause of this restriction in my dependency tree is?
I can get halfway there by uv tree --invert --package numpy
, resulting in (redacted):
numpy v2.0.2
├── numba v0.60.0
| └── my_main_project v0.1.0
├── matplotlib v3.9.3
└── scipy v1.14.1
However, this is forcing me to walk the respective packages by hand to find the restriction.
Much more convenient here (pip install pipdeptree
):
$ pipdeptree -r -p numpy
numpy==2.0.2
├── numba==0.60.0 [requires: numpy>=1.22,<2.1]
│ └── my_main_project v0.1.0 [requires: numba>=0.60]
├── matplotlib==3.9.3 [requires: numpy>=1.23]
...
└── scipy==1.14.1 [requires: numpy>=1.23.5,<2.3]
Is there any way to produce this with native uv
?
Currently this is not possible, as the necessary information is not stored in the lock file.
An alternative is to use uv pip tree
with --show-version-specifiers
:
$ uv pip tree --invert --package numpy --show-version-specifiers
numpy v2.0.2
├── contourpy v1.3.1 [requires: numpy >=1.23]
│ └── matplotlib v3.9.3 [requires: contourpy >=1.0.1]
├── matplotlib v3.9.3 [requires: numpy >=1.23]
├── numba v0.60.0 [requires: numpy >=1.22, <2.1]
└── scipy v1.14.1 [requires: numpy >=1.23.5, <2.3]
(uv pip tree
is a reimplementation of pipdeptree
.)