Remove _most_ of import_utils.py#6599
Merged
rapids-bot[bot] merged 15 commits intorapidsai:branch-25.06from Apr 29, 2025
Merged
Remove _most_ of import_utils.py#6599rapids-bot[bot] merged 15 commits intorapidsai:branch-25.06from
import_utils.py#6599rapids-bot[bot] merged 15 commits intorapidsai:branch-25.06from
Conversation
`cupy` is a required dependency, and has been for quite a while.
e5fb166 to
25187fc
Compare
csadorf
reviewed
Apr 29, 2025
csadorf
approved these changes
Apr 29, 2025
Contributor
|
/merge |
Ofek-Haim
pushed a commit
to Ofek-Haim/cuml
that referenced
this pull request
May 13, 2025
This PR started because I noticed most of the functions in `import_utils.py` were effectively dead code. It spiraled out a bit from there to remove _almost all_ of `import_utils.py` in favor of: - Using `pytest.importorskip` to handle conditional imports in tests. This is the proper `pytest` pattern to do this, and is both easier to get correct and uses fewer lines of code. - Localized import checks (see `hdbscan.pyx`). Keeping the import check local to the module is easier to read IMO, and also helps avoid dead code accumulating in a global utils file. - No import checks. Things like `cupy` are required dependencies and don't need to be gated at all. The remaining functions will be removed in other PRs: - `has_dask` will go away once `dask` is made optional (see rapidsai#5934) - `has_scipy` is removed in rapidsai#6596 - `has_sklearn` will go away once `sklearn` is made a required dependency Authors: - Jim Crist-Harif (https://github.com/jcrist) Approvers: - Simon Adorf (https://github.com/csadorf) URL: rapidsai#6599
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR started because I noticed most of the functions in
import_utils.pywere effectively dead code. It spiraled out a bit from there to remove almost all ofimport_utils.pyin favor of:pytest.importorskipto handle conditional imports in tests. This is the properpytestpattern to do this, and is both easier to get correct and uses fewer lines of code.hdbscan.pyx). Keeping the import check local to the module is easier to read IMO, and also helps avoid dead code accumulating in a global utils file.cupyare required dependencies and don't need to be gated at all.The remaining functions will be removed in other PRs:
has_daskwill go away oncedaskis made optional (see [FEA] Convert Dask into an optional dependency #5934)has_scipyis removed in Remove guarded imports ofscipy#6596has_sklearnwill go away oncesklearnis made a required dependency