Skip to content

Deprecate cupy array backend#881

Open
priyam0k wants to merge 2 commits into
casact:mainfrom
priyam0k:feature/843-deprecate-cupy
Open

Deprecate cupy array backend#881
priyam0k wants to merge 2 commits into
casact:mainfrom
priyam0k:feature/843-deprecate-cupy

Conversation

@priyam0k
Copy link
Copy Markdown
Contributor

@priyam0k priyam0k commented May 29, 2026

Summary of Changes

Emit a DeprecationWarning whenever the cupy array 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 DeprecationWarning when users select the cupy array backend, without removing cupy support (issue #843).

Warnings fire at Options.set_option for ARRAY_BACKEND='cupy' or when 'cupy' appears in ARRAY_PRIORITY, and at Triangle.set_backend('cupy') with stacklevel=2 so the warning points at caller code. set_backend gains an internal _warn flag 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.

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.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread chainladder/core/common.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.10%. Comparing base (449b5c1) to head (8c06433).

Files with missing lines Patch % Lines
chainladder/core/common.py 80.00% 1 Missing ⚠️
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              
Flag Coverage Δ
unittests 87.10% <90.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
@henrydingliu
Copy link
Copy Markdown
Collaborator

@genedan I'd like to defer this review to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate Cupy

2 participants