snkit has networkx as an optional dependency. If you don't have networkx, but try to use functions that require it, snkit tries to raise an import error. However, there are type hints in function signatures in network.py that use networkx and therefore when importing snkit without networkx, snkit fails on load with the following:
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] on linux
>>> import snkit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/fred/micromamba/envs/jamaica-infrastructure/lib/python3.10/site-packages/snkit/__init__.py", line 7, in <module>
from snkit.network import Network
File "/home/fred/micromamba/envs/jamaica-infrastructure/lib/python3.10/site-packages/snkit/network.py", line 964, in <module>
) -> Union[nx.Graph, nx.DiGraph]:
NameError: name 'nx' is not defined. Did you mean: 'np'?
snkithasnetworkxas an optional dependency. If you don't havenetworkx, but try to use functions that require it,snkittries to raise an import error. However, there are type hints in function signatures in network.py that usenetworkxand therefore when importingsnkitwithoutnetworkx,snkitfails on load with the following: