Deprecate cupy array backend#881
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.
|
@genedan I'd like to defer this review to you. |
|
gentle bump on this one whenever you get a chance @genedan — it follows the three hookpoints you outlined on #843 (the two set_option paths + set_backend), warning-only per @henrydingliu's note, with a small test confirming the warnings fire. ci's green. if it looks good i'm happy to do the matching dask deprecation (#842) next so they stay consistent. |

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.