Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Drop hard networkx dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirshup authored and skrawcz committed Dec 12, 2021
1 parent d17a5ca commit f00dbf4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions hamilton/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from types import ModuleType
from typing import Type, Dict, Any, Callable, Tuple, Set, Collection, List

import networkx

from hamilton import function_modifiers
from hamilton import node
from hamilton.node import NodeSource, DependencyType
Expand Down Expand Up @@ -147,6 +145,14 @@ def display(nodes: Set[node.Node], user_nodes: Set[node.Node], output_file_path:
'\n\n pip install graphviz'
)

try:
import networkx
except ModuleNotFoundError:
raise ModuleNotFoundError(
'networkx is required for visualizing the function graph. Install it with:'
'\n\n pip install networkx'
)

dot = graphviz.Digraph(comment='Dependency Graph')

for n in nodes:
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dataclasses
networkx
numpy
pandas

0 comments on commit f00dbf4

Please sign in to comment.