Repository navigation
Commit 3995a26
committed
Remove sklearn<=1.6 compatibility code (#985)
The project already requires scikit-learn>=1.7.0 (pyproject.toml,
tox.ini, .circleci/config.yml), so the sklearn<=1.6 branches of every
check_estimator/tags conditional were dead code. This removes them,
keeping only the >=1.6 branch (the one using
check_estimator(expected_failed_checks=...)):
- feature_engine/tags.py: collapse the sklearn_version > 1.6 check in
_return_tags(), the shared helper used across ~20 estimator classes.
- 11 tests/**/test_check_estimator_*.py files: collapse each
if/else on sklearn_version vs 1.6, drop the now-unused sklearn/
parse_version imports and sklearn_version variables.
- tests/test_prediction/test_check_estimator_prediction.py: this file
had no >=1.6 branch, only the dead <1.6 one (its own TODO already
flagged this). Removing it leaves the prediction module with no
test_check_estimator_from_sklearn coverage - a pre-existing gap,
not introduced by this change, left as a follow-up.
- tests/test_creation/test_geo_features.py: __sklearn_tags__ always
exists at sklearn>=1.7, so drop the hasattr() guard around it.
- tests/test_wrappers/test_sklearn_wrapper.py: also collapse the
_OneHotEncoder() test helper's sparse/sparse_output branch (sklearn
<1.2 compat, dead for the same reason). The separate
KBinsDiscretizer(quantile_method=...) branch (sklearn<1.7) is
intentionally left as-is - different threshold, out of scope here.
- tests/check_estimators_with_parametrize_tests.py: delete entirely.
A standalone, non-CI reference file documenting the pre-1.6
parametrize_with_checks() call signature.
_more_tags()/__sklearn_tags__() method definitions are untouched:
_more_tags() is feature_engine's own internal metadata/xfail-checks
store (read by tests/estimator_checks/*.py), not a legacy sklearn
shim, and __sklearn_tags__() is the current sklearn API.
Verified: identical test suite pass/fail counts before and after
(2010 passed, 114 failed - all 114 are pre-existing narwhals-migration
WIP failures unrelated to this change), flake8 and mypy clean (the one
remaining mypy error is pre-existing in datetime_subtraction.py,
unrelated to this PR).1 parent 66c2e9e commit 3995a26
15 files changed
Lines changed: 172 additions & 503 deletions
File tree
- feature_engine
- tests
- test_creation
- test_discretisation
- test_encoding
- test_imputation
- test_outliers
- test_prediction
- test_preprocessing
- test_selection
- test_time_series/test_forecasting
- test_transformation
- test_wrappers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 1 | | |
8 | 2 | | |
9 | 3 | | |
| |||
32 | 26 | | |
33 | 27 | | |
34 | 28 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
45 | 38 | | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
21 | | - | |
22 | | - | |
23 | 19 | | |
24 | 20 | | |
25 | 21 | | |
| |||
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 32 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
50 | 39 | | |
51 | 40 | | |
52 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 359 | + | |
| 360 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 20 | | |
26 | 21 | | |
27 | 22 | | |
| |||
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 28 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
47 | 35 | | |
48 | 36 | | |
49 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | | - | |
30 | | - | |
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
| |||
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 46 | + | |
| 47 | + | |
55 | 48 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 49 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
67 | 57 | | |
68 | 58 | | |
69 | 59 | | |
| |||
0 commit comments