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

[feature] Add command to query *why* a package is a dependency #15837

Closed
1 task done
fschoenm opened this issue Mar 8, 2024 · 5 comments
Closed
1 task done

[feature] Add command to query *why* a package is a dependency #15837

fschoenm opened this issue Mar 8, 2024 · 5 comments
Assignees

Comments

@fschoenm
Copy link

fschoenm commented Mar 8, 2024

What is your suggestion?

I'd like to suggest a subcommand to query why a certain dependency is part of the dependency graph. As far as I know there's no such command or option in conan graph info. It seems to be possible to do a related query with conan graph info --package-filter but that doesn't show where the dependency comes from.

Example: Many packages require openssl but because we don't do network communication, we want to get rid of this dependency by finding the package(s) that require it and changing their options. The command could be something like conan graph why 'openssl/*' (inspired by aptitude why). Maybe it could also be an option of conan graph explain or conan graph info.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@jcar87 jcar87 self-assigned this Mar 8, 2024
@jcar87
Copy link
Contributor

jcar87 commented Mar 8, 2024

HI @fschoenm - thanks for this request.

With the html output of conan graph info you should be able to easily see exactly where the dependencies come from:

conan graph info <path> --format=html > dependency_graph.html

Will check with the team to see the feasibility of having a subcommand.

@fschoenm
Copy link
Author

fschoenm commented Mar 8, 2024

Hi @jcar87, I tried to use the graph view but it has a lot of problems IMHO:

  • It's annoying to work with when working remotely/without GUI.
  • The output is not very well documented, e.g. I have no idea what the colors (white, light blue, red) and different forms (circle, rectangle) in this output even mean? It's also unclear why sometimes packages are combined into one and sometimes appear multiple times.
  • In complex dependency graphs, it becomes unusable. In the default view, half the packages are overlapping. There's no search or filter function. The browser search doesn't work either. The graph controls are all kind of useless. ...

@AbrilRBS
Copy link
Member

AbrilRBS commented Mar 19, 2024

Hi @fschoenm

For Conan 2.2 we're releasing a new conan graph info ... --format=html design that addresses all the points you mentioned. It provides a legend of every kind of node, provides interactive toggling and grouping of nodes, is able to provide extra context of edges, etc. It's now also sorted in a smarter way and you can search for packages, I suggest taking a look into it and give us your feedback. You can check how that looks in the PR #15846

A few extra things:

  • We haven't ruled out adding a conan graph why yet, but if that happens it would take a bit more time
  • For now, with jq you can get this behaviour with the --format=json output, like this: graph.json | jq '.graph.nodes[] | select(.dependencies[].ref == "zlib/1.3.1") | .name' would show the names of my conan graph info ... -f=json > graph.html file which has zlib as a direct dependency

Let me know if that helps, happy to hear back from you :)

@fschoenm
Copy link
Author

@RubenRBS Thanks, the new dependency graph looks much more useful this way. I'm looking forward to try it.

I didn't think a new graph layout would be easier than implementing a why function but I'm happy :)

@memsharded
Copy link
Member

The new graph html is proving super useful to understand dependency graphs way better than before.

I am closing this issue as solved with it, thanks for the feedback!

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

No branches or pull requests

4 participants