Skip to content

Fix 'was removed in version None' message in deprecated / deprecated_arg - #9291

Open
eliem08 wants to merge 2 commits into
Project-MONAI:devfrom
eliem08:fix/deprecated-version-none
Open

eliem08 wants to merge 2 commits into
Project-MONAI:devfrom
eliem08:fix/deprecated-version-none

Conversation

@eliem08

@eliem08 eliem08 commented Nov 19, 2026

Copy link
Copy Markdown

Bare @deprecated() / @deprecated_arg() with no versions set treat the object as already removed and raise DeprecatedError claiming it "was removed in version None".

This makes the version phrase conditional on removed being set, so the bare case now says "was removed." while the versioned case still says "was removed in version ." — the same conditional-phrase pattern as #9197 for deprecated_arg_default.

Adds two message tests (test_except1_message, test_arg_except1_message) covering both the bare and versioned cases. No in-repo caller hits this today (all pass explicit versions); it bites downstream users who use the decorators without versions.

tests/utils/test_deprecated.py: 33 passed (31 existing + 2 new).

Signed-off-by: Ilyass Emssaad emssaadelias@gmail.com

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review.

Walkthrough

The deprecated and deprecated_arg decorators omit the removal-version clause when removed is None. When a removal version is set, the messages include it. Tests cover both cases for each decorator.

Estimated code review effort: 2 (Simple) | ~8 minutes

Merge Risk: Minimal · up to 174dc

This is a message-wording fix for bare deprecation decorators. Versioned messages are unchanged, and tests cover both cases. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed Title names the actual change: the 'was removed in version None' message in deprecated and deprecated_arg. The diff makes the version clause conditional on removed being set, matching the title.
Description check Passed Description explains the bug, the conditional-phrase fix, the two new message tests, and the test run result. It also states no in-repo caller hits the bare case. The template's Description and Types …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

Description explains the bug, the conditional-phrase fix, the two new message tests, and the test run result. It also states no in-repo caller hits the bare case. The template's Description and Types of changes sections are present. Checklist items are not all marked, but the non-breaking change box is checked, which fits the fix.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a478adb and 174dc20.

Files selected for processing: 2

  • monai/utils/deprecate_utils.py
  • tests/utils/test_deprecated.py
Files skipped from review as they are similar to previous changes: 1

  • monai/utils/deprecate_utils.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@eliem08
eliem08 force-pushed the fix/deprecated-version-none branch from 897d585 to a478adb Compare November 25, 2026 00:14
Signed-off-by: Ilyass Emssaad <emssaadelias@gmail.com>
Signed-off-by: Ilyass Emssaad <emssaadelias@gmail.com>
@eliem08
eliem08 force-pushed the fix/deprecated-version-none branch from a478adb to 174dc20 Compare November 25, 2026 00:22

This branch has not been deployed

No deployments
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.

1 participant