[question] How to exclude tool_requires from graph info output
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?
- [X] I've read the CONTRIBUTING guide
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
Thank you very much! That's great to know and exactly what I need.
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 %}
}
re-opening to add a bit more of docs
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.