Skip to content

Commit a883404

Browse files
authored
add docs (#3644)
1 parent 77d38ab commit a883404

File tree

2 files changed

+49
-16
lines changed

2 files changed

+49
-16
lines changed

images/conan-graph-info-html.png

141 KB
Loading

reference/commands/graph/info.rst

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -230,25 +230,36 @@ For example, to get the options of zlib, the following command could be run:
230230
shared: False
231231
232232
233-
You can generate a graph of your dependencies in ``json``, ``dot`` or ``html`` formats:
233+
Available formatters
234+
--------------------
234235

235-
Now, let's try the ``dot`` format for instance:
236+
json formatter
237+
^^^^^^^^^^^^^^
238+
239+
For the documentation about the JSON formatter, please check the :ref:`dedicated section <reference_commands_graph_info_json_format>`.
240+
241+
dot formatter
242+
^^^^^^^^^^^^^
243+
244+
To use the DOT format, execute the following command:
236245

237246
.. code-block:: bash
238-
:caption: **binutils/2.38 graph info to DOT**
247+
:caption: binutils/2.38 graph info DOT representation
239248
240249
$ conan graph info --require=binutils/2.38 -r=conancenter --format=dot > graph.dot
241250
242-
Which generates the following file:
251+
This command generates a DOT file with the following content:
243252

244253
.. code-block:: dot
245-
:caption: **graph.dot**
254+
:caption: Contents of graph.dot
246255
247256
digraph {
248-
"cli" -> "binutils/2.38"
249-
"binutils/2.38" -> "zlib/1.2.13"
257+
"cli" -> "binutils/2.38"
258+
"binutils/2.38" -> "zlib/1.2.13"
250259
}
251260
261+
To visualize this graph, you can render it using Graphviz or any compatible tool.
262+
252263
.. graphviz::
253264

254265
digraph {
@@ -257,17 +268,39 @@ Which generates the following file:
257268
}
258269

259270

260-
.. note::
261-
If using ``format=html``, the generated html contains links to a third-party resource,
262-
the *vis.js* library with 2 files: *vis.min.js*, *vis.min.css*.
263-
By default they are retrieved from Cloudfare. However, for environments without internet connection,
264-
you'll need to create a template for the file and place it in ``CONAN_HOME/templates/graph.html``.
265-
to point to a local version of these files:
266271

267-
- *vis.min.js*: "https://cdnjs.cloudflare.com/ajax/libs/vis/4.18.1/vis.min.js"
268-
- *vis.min.css*: "https://cdnjs.cloudflare.com/ajax/libs/vis/4.18.1/vis.min.css"
272+
html formatter
273+
^^^^^^^^^^^^^^
274+
275+
The HTML formatter provides a visual representation of the dependency graph that is both
276+
interactive and user-friendly.
277+
278+
.. code-block:: bash
279+
280+
$ conan graph info --require=tensorflow-lite/2.12.0 -r=conancenter --format=html > graph.html
281+
282+
283+
The HTML output displays an interactive graph of your project's dependencies, featuring
284+
nodes for packages with versions, directional arrows for dependencies, and color-coded
285+
labels for dependency types. You can interact with the graph to filter visibility of
286+
dependencies and access package details and status.
287+
288+
289+
.. image:: ../../../images/conan-graph-info-html.png
290+
:target: ../../../_images/conan-graph-info-html.png
291+
292+
.. note::
269293

270-
You can use the template found in ``cli/formatters/graph/info_graph.html`` as a basis for your own.
294+
When using ``format=html``, the generated HTML contains links to a third-party
295+
resource: the `vis-network <https://github.com/visjs/vis-network>`_ library trough the
296+
*vis-network.min.js* file. By default, this file is retrieved from Cloudflare.
297+
However, for environments without an internet connection, you will need to create a
298+
template for the file and place it in ``CONAN_HOME/templates/graph.html`` to point to
299+
a local version of `the remote vis-network.min.js file <https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.9/standalone/umd/vis-network.min.js>`_
300+
301+
Use the template located in
302+
``<conan_sources>/conan/cli/formatters/graph/info_graph_html.py`` as a starting point for
303+
your own.
271304

272305

273306
.. seealso::

0 commit comments

Comments
 (0)