Skip to content

Commit 396dfd1

Browse files
committed
added with_graph/plot_support() functions to check whether pww3 has graph/plot support via pygraphviz/matplotlib
1 parent 06fe7bd commit 396dfd1

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Changelog
1212
a requirements text file now as well
1313
- added `pww_version()` function to `weka.core.version` to obtain the installed
1414
version of python-weka-wrapper3
15+
- added `with_graph_support()` function to `weka.core.version` to see whether
16+
python-weka-wrapper3 has support for graphs using pygraphviz
17+
- added `with_plot_support()` function to `weka.core.version` to see whether
18+
python-weka-wrapper3 has plotting support via matplotlib
1519
- added sub-command `bootstrap` to the `pww-packages` command-line tool to output a
1620
Python script that can reinstall python-weka-wrapper3 and all the packages in
1721
another virtual environment or even another machine

python/weka/core/version.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,31 @@ def pww_version():
4040
return importlib.metadata.version('python-weka-wrapper3')
4141
except:
4242
return None
43+
44+
45+
def with_graph_support():
46+
"""
47+
Checks whether pygraphviz is installed for graph support.
48+
49+
:return: True if with pygraphviz support
50+
:rtype: bool
51+
"""
52+
try:
53+
importlib.metadata.version('pygraphviz')
54+
return True
55+
except:
56+
return False
57+
58+
59+
def with_plot_support():
60+
"""
61+
Checks whether matplotlib is installed for plot support.
62+
63+
:return: True if with matplotlib support
64+
:rtype: bool
65+
"""
66+
try:
67+
importlib.metadata.version('matplotlib')
68+
return True
69+
except:
70+
return False

0 commit comments

Comments
 (0)