Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 7b21653

Browse files
committed
plugins: Do not check deps if already installed
Signed-off-by: John Andersen <[email protected]>
1 parent 07ea080 commit 7b21653

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

dffml/plugins.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,20 @@ def inpath(binary):
5454
("source", "mysql"),
5555
]
5656

57-
# Dependencies of plugins and how to check if they exist on the system or not
58-
def check_daal4py():
57+
58+
def python_package_installed(module_name: str) -> bool:
59+
"""
60+
Check if a Python package is installed and can be imported
61+
"""
5962
spec = None
6063
with contextlib.suppress(ModuleNotFoundError):
61-
spec = importlib.util.find_spec("daal4py")
64+
spec = importlib.util.find_spec(module_name)
6265
return bool(spec is not None)
6366

6467

68+
# Dependencies of plugins and how to check if they exist on the system or not
69+
70+
6571
def check_boost():
6672
# TODO Implement check on Windows
6773
if os.name == "nt":
@@ -94,18 +100,22 @@ def check_boost():
94100
("model", "vowpalWabbit"): {
95101
"cmake": lambda: inpath("cmake"),
96102
"boost": check_boost,
97-
},
103+
}
104+
if not python_package_installed("vowpalwabbit")
105+
else {},
98106
("model", "autosklearn"): {
99107
"swig": lambda: inpath("swig"),
100108
"cython": lambda: inpath("cython"),
101-
},
109+
}
110+
if not python_package_installed("auto_sklearn")
111+
else {},
102112
}
103113

104114
# Plugins which currently don't support Python 3.8
105115
if sys.version_info.major == 3 and sys.version_info.minor < 8:
106116
CORE_PLUGIN_DEPS[("model", "daal4py")] = {
107117
# Must be installed already via conda, do not provide a pypi package yet
108-
"daal4py": check_daal4py
118+
"daal4py": lambda: python_package_installed("daal4py")
109119
}
110120

111121
# All packages under configloader/ are really named dffml-config-{name}

0 commit comments

Comments
 (0)