Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: uv tree --invert --package ... sometimes also displays packages I didn't ask for #11349

Open
neutrinoceros opened this issue Feb 9, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@neutrinoceros
Copy link

Summary

When I run uv tree --invert --package ... against astropy, I sometimes get more packages to show up in the displayed tree than I asked for, which seems like a bug.
This is obvious when requesting a single package as root and limiting the depth to 0.

❯ git clone https://github.com/astropy/astropy
❯ cd astropy
❯ uv tree --invert --package setuptools -d 0 --no-config
Resolved 166 packages in 8ms
asdf-astropy v0.7.0
setuptools v75.8.0
❯ uv tree --invert --package six -d 0 --no-config
Resolved 166 packages in 8ms
asdf-astropy v0.7.0
six v1.17.0

In all cases I found that reproduce this problem, asdf-astropy seems to be the one package that show up uninvited. However, it may or may not show up depending on the package I ask for:

❯ uv tree --invert --package numpy -d 0
Resolved 166 packages in 1ms
numpy v2.2.2

The output seems consistent (no randomness I can see) for any given command, however I don't have a clear idea why --package numpy works and --package six doesn't. My experiments suggest it has nothing to do with numpy being a direct and hard dependency to astropy, as I also hit the bug with --package astropy-iers-data

❯ uv tree --invert --package astropy-iers-data -d 0
Resolved 166 packages in 1ms
asdf-astropy v0.7.0
astropy-iers-data v0.2025.2.3.0.32.42

I wasn't able to reproduce this with a simpler package, though I admit I only tried a bottom-up approach; I did not attempt to simplify astropy's dependencies.

Platform

macOS 15.3 arm64

Version

uv 0.5.29 (ca73c47 2025-02-05)

Python version

Python 3.12.9

@neutrinoceros neutrinoceros added the bug Something isn't working label Feb 9, 2025
@charliermarsh
Copy link
Member

Thanks, we'll take a look.

@charliermarsh
Copy link
Member

I think this is because there's a circular dependency in the graph, whereby asdf-astropy depends on astropy, but astropy depends on asdf-astropy -- at least, as far as I can tell? So, like, it's trying to show you that setuptools is required by astropy-sphinx-theme which is required by sphinx-astropy which is required by astropy, but then astropy is both required by and requires asdf-astropy, which is hard to display.

@neutrinoceros
Copy link
Author

asdf-astropy depends on astropy, but astropy depends on asdf-astropy -- at least, as far as I can tell?

I can confirm it does, and sorry for not thinking of this earlier !

I think this is because there's a circular dependency in the graph (...) which is hard to display.

Granted. Maybe the cycle could be indicated as ..., inspired by the Python repr for self-referential objects, as in

>>> L = []
>>> L.append(L)
>>> print(L)
[[...]]

?

@JadenMajid
Copy link

Hi, can i work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants