Deprecate cupy array backend#881
Open
priyam0k wants to merge 2 commits into
Open
Conversation
Emit DeprecationWarning when the cupy backend is selected, without removing functionality: - Options.set_option warns for ARRAY_BACKEND='cupy' and for 'cupy' in ARRAY_PRIORITY. - Common.set_backend warns when backend='cupy'. Adds tests asserting the warnings fire and that non-cupy backends do not warn.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 69ab9b0. Configure here.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #881 +/- ##
==========================================
+ Coverage 87.04% 87.10% +0.06%
==========================================
Files 86 86
Lines 4986 4994 +8
Branches 646 649 +3
==========================================
+ Hits 4340 4350 +10
+ Misses 456 454 -2
Partials 190 190
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Move the DeprecationWarning to set_backend's public entry point and add a private _warn guard so internal recursive (inplace) and deep-child calls do not re-warn. This makes stacklevel=2 point at the user's call site and ensures exactly one warning fires. Strengthens the test to assert a single warning at the caller's file.
Collaborator
|
@genedan I'd like to defer this review to you. |
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.

Summary of Changes
Emit a
DeprecationWarningwhenever thecupyarray backend is selected, without removing any functionality (per @henrydingliu's guidance to warn only before 1.0). Covers all three entry points a user can enable cupy through:Options.set_option('ARRAY_BACKEND', 'cupy')→ warns.Options.set_option('ARRAY_PRIORITY', [...])→ warns when'cupy'is in the list.Triangle.set_backend('cupy')→ warns (fires once, in the inplace branch).Added tests asserting the warnings fire and that non-cupy backends do not warn.
Related GitHub Issue(s)
Closes #843
Additional Context for Reviewers
No behaviour is removed — cupy still works; this is the deprecation-notice step only.
Warning messages link back to Deprecate Cupy #843 so users know where to follow up.
Files touched:
chainladder/__init__.py,chainladder/core/common.py,chainladder/utils/tests/test_utilities.py.I passed tests locally for both code (
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Low Risk
Notify-only deprecation with no removal of cupy behavior; limited to options and backend conversion entry points plus tests.
Overview
Adds
DeprecationWarningwhen users select thecupyarray backend, without removing cupy support (issue #843).Warnings fire at
Options.set_optionforARRAY_BACKEND='cupy'or when'cupy'appears inARRAY_PRIORITY, and atTriangle.set_backend('cupy')withstacklevel=2so the warning points at caller code.set_backendgains an internal_warnflag so deep/recursive conversions do not spam duplicate warnings.New tests assert warnings appear for cupy paths, non-cupy options stay silent, and
set_backend(..., deep=True)emits exactly one warning attributed to the test file.Reviewed by Cursor Bugbot for commit 8c06433. Bugbot is set up for automated code reviews on this repo. Configure here.