Skip to content

Commit 3b04654

Browse files
authored
Remove scikit-learn extension as submodule, publish independently instead (openml#1424)
* Delete the extension * Remove scikit-learn extension submodule It will now be hosted in a separate repository * Do not load sklearn extension by default * Disable scikit-learn tests * Tests fail successfully * Add openml-sklearn as dependency of sklearn tests * Make use of openml_sklearn extension * packaging is only used in test submodules
1 parent 6103874 commit 3b04654

File tree

16 files changed

+53
-4845
lines changed

16 files changed

+53
-4845
lines changed

openml/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,3 @@ def populate_cache(
121121
"_api_calls",
122122
"__version__",
123123
]
124-
125-
# Load the scikit-learn extension by default
126-
# TODO(eddiebergman): Not sure why this is at the bottom of the file
127-
import openml.extensions.sklearn # noqa: E402, F401

openml/extensions/functions.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313

1414
from . import Extension
1515

16+
SKLEARN_HINT = (
17+
"But it looks related to scikit-learn. "
18+
"Please install the OpenML scikit-learn extension (openml-sklearn) and try again. "
19+
"For more information, see "
20+
"https://github.com/openml/openml-sklearn?tab=readme-ov-file#installation"
21+
)
22+
1623

1724
def register_extension(extension: type[Extension]) -> None:
1825
"""Register an extension.
@@ -57,7 +64,13 @@ def get_extension_by_flow(
5764
candidates.append(extension_class())
5865
if len(candidates) == 0:
5966
if raise_if_no_extension:
60-
raise ValueError(f"No extension registered which can handle flow: {flow}")
67+
install_instruction = ""
68+
if flow.name.startswith("sklearn"):
69+
install_instruction = SKLEARN_HINT
70+
raise ValueError(
71+
f"No extension registered which can handle flow: {flow.flow_id} ({flow.name}). "
72+
f"{install_instruction}"
73+
)
6174

6275
return None
6376

@@ -96,7 +109,12 @@ def get_extension_by_model(
96109
candidates.append(extension_class())
97110
if len(candidates) == 0:
98111
if raise_if_no_extension:
99-
raise ValueError(f"No extension registered which can handle model: {model}")
112+
install_instruction = ""
113+
if type(model).__module__.startswith("sklearn"):
114+
install_instruction = SKLEARN_HINT
115+
raise ValueError(
116+
f"No extension registered which can handle model: {model}. {install_instruction}"
117+
)
100118

101119
return None
102120

openml/extensions/sklearn/__init__.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)