-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python-package][R-package] adapt to scikit-learn 1.6 testing changes, pin more packages in R 3.6 CI jobs #6718
Changes from all commits
05cd10f
2ee3863
dd2b65c
175aa54
829b8ce
1172e32
29ef27e
8fd01c1
05245e9
40a663f
256837e
feeb13e
69ded07
f04e658
2be59e1
c607c99
2cff81c
dc43998
2563bba
35f2c0b
530474a
cffba58
44c77a8
94ef6a6
7a9087e
dda842d
8e36ef0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# [description] | ||
# | ||
# Installs a pinned set of packages that worked together | ||
# as of the last R 3.6 release. | ||
# | ||
|
||
.install_packages <- function(packages) { | ||
install.packages( # nolint: undesirable_function | ||
pkgs = paste( # nolint: paste | ||
"https://cran.r-project.org/src/contrib/Archive" | ||
, packages | ||
, sep = "/" | ||
) | ||
, dependencies = FALSE | ||
, lib = Sys.getenv("R_LIBS") | ||
, repos = NULL | ||
) | ||
} | ||
|
||
# when confronted with a bunch of URLs like this, install.packages() sometimes | ||
# struggles to determine install order... so install packages in batches here, | ||
# starting from the root of the dependency graph and working up | ||
|
||
# there was only a single release of {praise}, so there is no contrib/Archive URL for it | ||
install.packages( # nolint: undesirable_function | ||
pkgs = "https://cran.r-project.org/src/contrib/praise_1.0.0.tar.gz" | ||
, dependencies = FALSE | ||
, lib = Sys.getenv("R_LIBS") | ||
, repos = NULL | ||
) | ||
|
||
.install_packages(c( | ||
"brio/brio_1.1.4.tar.gz" # nolint: non_portable_path | ||
, "cli/cli_3.6.2.tar.gz" # nolint: non_portable_path | ||
, "crayon/crayon_1.5.2.tar.gz" # nolint: non_portable_path | ||
, "digest/digest_0.6.36.tar.gz" # nolint: non_portable_path | ||
, "evaluate/evaluate_0.23.tar.gz" # nolint: non_portable_path | ||
, "fansi/fansi_1.0.5.tar.gz" # nolint: non_portable_path | ||
, "fs/fs_1.6.4.tar.gz" # nolint: non_portable_path | ||
, "glue/glue_1.7.0.tar.gz" # nolint: non_portable_path | ||
, "jsonlite/jsonlite_1.8.8.tar.gz" # nolint: non_portable_path | ||
, "lattice/lattice_0.20-41.tar.gz" # nolint: non_portable_path | ||
, "magrittr/magrittr_2.0.2.tar.gz" # nolint: non_portable_path | ||
, "pkgconfig/pkgconfig_2.0.2.tar.gz" # nolint: non_portable_path | ||
, "ps/ps_1.8.0.tar.gz" # nolint: non_portable_path | ||
, "R6/R6_2.5.0.tar.gz" # nolint: non_portable_path | ||
, "rlang/rlang_1.1.3.tar.gz" # nolint: non_portable_path | ||
, "rprojroot/rprojroot_2.0.3.tar.gz" # nolint: non_portable_path | ||
, "utf8/utf8_1.2.3.tar.gz" # nolint: non_portable_path | ||
, "withr/withr_3.0.1.tar.gz" # nolint: non_portable_path | ||
)) | ||
|
||
.install_packages(c( | ||
"desc/desc_1.4.2.tar.gz" # nolint: non_portable_path | ||
, "diffobj/diffobj_0.3.4.tar.gz" # nolint: non_portable_path | ||
, "lifecycle/lifecycle_1.0.3.tar.gz" # nolint: non_portable_path | ||
, "processx/processx_3.8.3.tar.gz" # nolint: non_portable_path | ||
)) | ||
|
||
.install_packages(c( | ||
"callr/callr_3.7.5.tar.gz" # nolint: non_portable_path | ||
, "vctrs/vctrs_0.6.4.tar.gz" # nolint: non_portable_path | ||
)) | ||
|
||
.install_packages(c( | ||
"pillar/pillar_1.8.1.tar.gz" # nolint: non_portable_path | ||
, "tibble/tibble_3.2.0.tar.gz" # nolint: non_portable_path | ||
)) | ||
|
||
.install_packages(c( | ||
"pkgbuild/pkgbuild_1.4.4.tar.gz" # nolint: non_portable_path | ||
, "rematch2/rematch2_2.1.1.tar.gz" # nolint: non_portable_path | ||
, "waldo/waldo_0.5.3.tar.gz" # nolint: non_portable_path | ||
)) | ||
|
||
.install_packages(c( | ||
"pkgload/pkgload_1.3.4.tar.gz" # nolint: non_portable_path | ||
, "testthat/testthat_3.2.1.tar.gz" # nolint: non_portable_path | ||
)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,14 @@ | |
from sklearn.utils.multiclass import check_classification_targets | ||
from sklearn.utils.validation import assert_all_finite, check_array, check_X_y | ||
|
||
# sklearn.utils Tags types can be imported unconditionally once | ||
# lightgbm's minimum scikit-learn version is 1.6 or higher | ||
try: | ||
from sklearn.utils import ClassifierTags as _sklearn_ClassifierTags | ||
from sklearn.utils import RegressorTags as _sklearn_RegressorTags | ||
except ImportError: | ||
_sklearn_ClassifierTags = None | ||
_sklearn_RegressorTags = None | ||
try: | ||
from sklearn.exceptions import NotFittedError | ||
from sklearn.model_selection import BaseCrossValidator, GroupKFold, StratifiedKFold | ||
|
@@ -140,6 +148,8 @@ class _LGBMRegressorBase: # type: ignore | |
_LGBMCheckClassificationTargets = None | ||
_LGBMComputeSampleWeight = None | ||
_LGBMValidateData = None | ||
_sklearn_ClassifierTags = None | ||
_sklearn_RegressorTags = None | ||
Comment on lines
+151
to
+152
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these defined again here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because if an earlier except ImportError:
_sklearn_ClassifierTags = None
_sklearn_RegressorTags = None And then the Happy to consider something else if you have a recommendation for improving this! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah, sorry. The first one is defined for scikit-learn<1.6 and the second when scikit-learn isn't installed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah exactly. No need to be sorry, it's confusing! |
||
_sklearn_version = None | ||
|
||
# additional scikit-learn imports only for type hints | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these hard-coded versions are the latest for which there's a package at https://cran.r-project.org/src/contrib/Archive. That provides a set of packages that were all working together as of a few days ago.
We shouldn't need to actively manage this list... this should be able to remain untouched (I hope) until we drop R 3 support and delete this script entirely.