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

[question] How to exclude tool_requires from graph info output #3603

Open
1 task done
nicosmd opened this issue Feb 22, 2024 · 5 comments
Open
1 task done

[question] How to exclude tool_requires from graph info output #3603

nicosmd opened this issue Feb 22, 2024 · 5 comments
Assignees
Milestone

Comments

@nicosmd
Copy link
Contributor

nicosmd commented Feb 22, 2024

What is your question?

Hey,

I would like to create a graph visualization using graph info .. --format=dot ... We have defined some tool_requires in the host profile to apply them to the every package. The resulting graph visualization is now really a mess since every package is pointing to those tool_requires.

Is there a way to hide tool_requires for the graph output?

Thank you very much!

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@nicosmd nicosmd changed the title [question] Hot to exclude tool_requires from graph info output [question] How to exclude tool_requires from graph info output Feb 22, 2024
@memsharded memsharded self-assigned this Feb 22, 2024
@memsharded
Copy link
Member

Hi @nicosmd

The templates for html and dot graphs are customizable.
I think this feature is still not properly documented (just some hints in https://docs.conan.io/2/reference/commands/graph/info.html for html), but mostly:

  • The path is os.path.join(conan_api.cache_folder, "templates", "graph.dot")
  • Every node in the graph has the is_build_requires, so {% if node.is_build_requires %} can be used to filter if a node is in the build context or not

@nicosmd nicosmd closed this as completed Feb 22, 2024
@nicosmd
Copy link
Contributor Author

nicosmd commented Feb 22, 2024

Thank you very much! That's great to know and exactly what I need.

@nicosmd
Copy link
Contributor Author

nicosmd commented Feb 22, 2024

Just in case others came a cross this issue, this is the content of the os.path.join(conan_api.cache_folder, "templates", "graph.dot") file I've used in order to filter build dependencies:

digraph {
    {%- for src, dst in graph.edges %}
        {% if not dst.is_build_requires %}
            "{{ src.label }}" -> "{{ dst.label }}"
        {% endif %}
    {%- endfor %}
}

@memsharded memsharded transferred this issue from conan-io/conan Feb 22, 2024
@memsharded memsharded added this to the 2 milestone Feb 22, 2024
@memsharded memsharded reopened this Feb 22, 2024
@memsharded
Copy link
Member

re-opening to add a bit more of docs

@memsharded
Copy link
Member

FYI; the --format=html output has been greatly improved in 2.2, now it includes filters to hide build and test-requires, to group them, and many other improvements.

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

2 participants