From f1e112015096bb519f8096142bdccddc0ac804db Mon Sep 17 00:00:00 2001 From: Philip Wilk Date: Sun, 15 Mar 2026 12:16:08 +0000 Subject: [PATCH 1/2] mlxtend: drop redundant patch+test skips --- ...fier-fit-ensure-compatibility-with-s.patch | 80 ------------------- .../python-modules/mlxtend/default.nix | 9 --- 2 files changed, 89 deletions(-) delete mode 100644 pkgs/development/python-modules/mlxtend/0001-StackingCVClassifier-fit-ensure-compatibility-with-s.patch diff --git a/pkgs/development/python-modules/mlxtend/0001-StackingCVClassifier-fit-ensure-compatibility-with-s.patch b/pkgs/development/python-modules/mlxtend/0001-StackingCVClassifier-fit-ensure-compatibility-with-s.patch deleted file mode 100644 index 2d807ef2c2e0..000000000000 --- a/pkgs/development/python-modules/mlxtend/0001-StackingCVClassifier-fit-ensure-compatibility-with-s.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 1fb59eb42f4bef229b953de313c7e78f0857ea42 Mon Sep 17 00:00:00 2001 -From: Philip Wilk -Date: Sun, 23 Mar 2025 16:14:51 +0000 -Subject: [PATCH] StackingCVClassifier/fit: ensure compatibility with - *scikit-learn* versions 1.4 and above by dynamically selecting between - `fit_params` and `params` - ---- - mlxtend/classifier/stacking_cv_classification.py | 5 ++++- - mlxtend/regressor/stacking_cv_regression.py | 6 +++++- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/mlxtend/classifier/stacking_cv_classification.py b/mlxtend/classifier/stacking_cv_classification.py -index 5bff6907..f4c45b8c 100644 ---- a/mlxtend/classifier/stacking_cv_classification.py -+++ b/mlxtend/classifier/stacking_cv_classification.py -@@ -15,6 +15,7 @@ from sklearn.base import TransformerMixin, clone - from sklearn.model_selection import cross_val_predict - from sklearn.model_selection._split import check_cv - from sklearn.preprocessing import LabelEncoder -+from sklearn import __version__ as sklearn_version - - from ..externals.estimator_checks import check_is_fitted - from ..externals.name_estimators import _name_estimators -@@ -266,6 +267,8 @@ class StackingCVClassifier( - if self.verbose > 1: - print(_name_estimators((model,))[0][1]) - -+ param_name = "fit_params" if sklearn_version < "1.4" else "params" -+ - prediction = cross_val_predict( - model, - X, -@@ -273,10 +276,10 @@ class StackingCVClassifier( - groups=groups, - cv=final_cv, - n_jobs=self.n_jobs, -- fit_params=fit_params, - verbose=self.verbose, - pre_dispatch=self.pre_dispatch, - method="predict_proba" if self.use_probas else "predict", -+ **{param_name: fit_params}, - ) - - if not self.use_probas: -diff --git a/mlxtend/regressor/stacking_cv_regression.py b/mlxtend/regressor/stacking_cv_regression.py -index a1faf2ff..d2fb1c49 100644 ---- a/mlxtend/regressor/stacking_cv_regression.py -+++ b/mlxtend/regressor/stacking_cv_regression.py -@@ -19,6 +19,7 @@ from sklearn.base import RegressorMixin, TransformerMixin, clone - from sklearn.model_selection import cross_val_predict - from sklearn.model_selection._split import check_cv - from sklearn.utils import check_X_y -+from sklearn import __version__ as sklearn_version - - from ..externals.estimator_checks import check_is_fitted - from ..externals.name_estimators import _name_estimators -@@ -211,6 +212,9 @@ class StackingCVRegressor(_BaseXComposition, RegressorMixin, TransformerMixin): - fit_params = None - else: - fit_params = dict(sample_weight=sample_weight) -+ -+ param_name = "fit_params" if sklearn_version < "1.4" else "params" -+ - meta_features = np.column_stack( - [ - cross_val_predict( -@@ -221,8 +225,8 @@ class StackingCVRegressor(_BaseXComposition, RegressorMixin, TransformerMixin): - cv=kfold, - verbose=self.verbose, - n_jobs=self.n_jobs, -- fit_params=fit_params, - pre_dispatch=self.pre_dispatch, -+ **{param_name: fit_params}, - ) - for regr in self.regr_ - ] --- -2.47.1 - diff --git a/pkgs/development/python-modules/mlxtend/default.nix b/pkgs/development/python-modules/mlxtend/default.nix index c6ff6cfdbd23..faaac7767f54 100644 --- a/pkgs/development/python-modules/mlxtend/default.nix +++ b/pkgs/development/python-modules/mlxtend/default.nix @@ -38,11 +38,6 @@ buildPythonPackage rec { joblib ]; - patches = [ - # https://github.com/rasbt/mlxtend/issues/1117 - ./0001-StackingCVClassifier-fit-ensure-compatibility-with-s.patch - ]; - nativeCheckInputs = [ pytestCheckHook ]; pytestFlags = [ "-sv" ]; @@ -59,10 +54,6 @@ buildPythonPackage rec { "mlxtend/evaluate/tests/test_feature_importance.py" # urlopen error "mlxtend/evaluate/tests/test_bias_variance_decomp.py" # keras.api._v2 "mlxtend/evaluate/tests/test_bootstrap_point632.py" # keras.api._v2 - # Failing tests, most likely an upstream issue. See https://github.com/rasbt/mlxtend/issues/1117 - "mlxtend/classifier/tests/test_ensemble_vote_classifier.py" - "mlxtend/classifier/tests/test_stacking_classifier.py" - "mlxtend/classifier/tests/test_stacking_cv_classifier.py" ]; meta = { From 71f379dea1b43eb02d5d96b97cfd5cce46b9eddd Mon Sep 17 00:00:00 2001 From: Philip Wilk Date: Sun, 15 Mar 2026 12:38:26 +0000 Subject: [PATCH 2/2] mlxtend: skip failing test_perceptron tests --- pkgs/development/python-modules/mlxtend/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/python-modules/mlxtend/default.nix b/pkgs/development/python-modules/mlxtend/default.nix index faaac7767f54..8b0cf517676d 100644 --- a/pkgs/development/python-modules/mlxtend/default.nix +++ b/pkgs/development/python-modules/mlxtend/default.nix @@ -47,6 +47,14 @@ buildPythonPackage rec { "test_invalid_labels_1" "test_default" "test_nullability" + # see upstream issue https://github.com/rasbt/mlxtend/issues/1161 + # skip the "TypeError: only 0-dimensional arrays can be converted to Python scalars" failures in test_perceptron + "test_standardized_iris_data" + "test_progress_1" + "test_progress_2" + "test_progress_3" + "test_score_function" + "test_nonstandardized_iris_data" ]; disabledTestPaths = [