Coverage for install/scipp/utils/graph.py: 0%
13 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-11-17 01:51 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-11-17 01:51 +0000
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
4from typing import TYPE_CHECKING, Any
6if TYPE_CHECKING:
7 try:
8 from graphviz import Digraph
9 except ImportError:
10 Digraph = Any
11else:
12 Digraph = Any
15def make_graphviz_digraph(*args: Any, **kwargs: Any) -> Digraph:
16 try:
17 from graphviz import Digraph
18 except ImportError as err:
19 raise RuntimeError(
20 "Failed to import `graphviz`. "
21 "Use `pip install graphviz` (requires installed `graphviz` executable) or "
22 "`conda install -c conda-forge python-graphviz`."
23 ) from err
24 return Digraph(*args, **kwargs)