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

implement --no-dedupe for uv pip tree #4449

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

ChannyClaus
Copy link
Contributor

@ChannyClaus ChannyClaus commented Jun 22, 2024

Summary

Resolves #4439 partially.

Implements for uv pip tree:

  • --no-dedupe flag, similar to cargo tree --no-dedupe .
  • denote dependency cycles with (#) and add a footnote if there's a cycle (using (*) would require keeping track of the cycle state, so opted to do this instead).

Test Plan

The existing tests pass + added a couple of tests to validate --no-dedupe behavior.

@zanieb
Copy link
Member

zanieb commented Jun 22, 2024

I'm confused, why do we need a separate character for cycles?

@ChannyClaus
Copy link
Contributor Author

ChannyClaus commented Jun 22, 2024

I'm confused, why do we need a separate character for cycles?

if there's a cycle and --no-dedupe flag isn't given, wouldn't it potentially use (*) for two different things? never mind, just realized this is the current behavior. my intention was to disambiguate these two to make it clearer but maybe it isn't a big deal.

the behavior can be minorly confusing for cyclic dependencies though, probably (note the different error messages for the same set of installed distributions depending on the presence of --no-dedupe):

chankang@chans-Air ~/repos/uv -  (pip-tree-no-dedupe)
$ cargo run -q pip tree --no-dedupe
uv-cyclic-dependencies-c v0.1.0
└── uv-cyclic-dependencies-a v0.1.0
    └── uv-cyclic-dependencies-b v0.1.0
        └── uv-cyclic-dependencies-a v0.1.0 (*)
(*) Dependency cycle
chankang@chans-Air ~/repos/uv -  (pip-tree-no-dedupe)
$ cargo run -q pip tree
uv-cyclic-dependencies-c v0.1.0
└── uv-cyclic-dependencies-a v0.1.0
    └── uv-cyclic-dependencies-b v0.1.0
        └── uv-cyclic-dependencies-a v0.1.0 (*)
(*) Package tree already displayed

@zanieb
Copy link
Member

zanieb commented Jun 23, 2024

That seems fine, I'd just say "Package tree is a cycle and cannot be shown" instead

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@zanieb zanieb merged commit c127632 into astral-sh:main Jun 24, 2024
47 checks passed
@Peiffap Peiffap mentioned this pull request Jun 25, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv pip tree improvement
2 participants