Skip to content

docs: silence the AUROC deprecation warning by message, not module - #692

Closed
mangeshraut712 wants to merge 1 commit into
awslabs:devfrom
mangeshraut712:fix/493-silence-auroc-warning-by-message
Closed

mangeshraut712 wants to merge 1 commit into
awslabs:devfrom
mangeshraut712:fix/493-silence-auroc-warning-by-message

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

Fixes #493

Problem

"Silencing the legacy AUROC deprecation warning" (Guides/Evaluation/confidence-evaluation.md) filters by module="stickler.structured_object_evaluator.models.comparison_engine". The warning is raised once per process and attributed to the calling code, so that filter never matches and a reader who pastes it still sees the warning.

The lead-in also said the filter is for callers who have "already migrated". The warning fires on any compare_with(add_confidence_metrics=True) call, whether or not the legacy key is read, so there is nothing to migrate.

Change

Docs only. The section now filters by the message and says what the call does. This is the replacement text proposed in the issue.

Verification

Each run in its own process, with the filter installed before compare_with(add_confidence_metrics=True) under warnings.catch_warnings(record=True):

filter DeprecationWarnings recorded
none 1
documented module= (on dev) 1
new message= 0

The warning text, for the record: The 'auroc_confidence_metric' result key is deprecated; use result['confidence_metrics']['overall']['auroc']['value'] instead. …

  • The documented filter leaves no DeprecationWarning
  • The section no longer implies the warning depends on reading the key
  • python docs/check_links.py — exit 0, documentation builds
  • ruff check clean (no Python files change in this PR)

One note on the filter's position, since it tripped my first check: filterwarnings prepends, so a warnings.simplefilter("always") issued after installing this filter shadows it. That is standard warnings ordering and applies to any ignore rule, so I left it out of the page.

The "Silencing the legacy AUROC deprecation warning" section filters by
module="stickler.structured_object_evaluator.models.comparison_engine". The
warning is raised once per process and attributed to the calling code, so that
filter never matches and a reader who pastes it still sees the warning.

Filter by the message instead, which matches wherever the warning is
attributed. The lead-in also said the filter is for callers who have "already
migrated"; the warning fires on any compare_with(add_confidence_metrics=True)
call, whether or not the legacy key is read, so the section now says what the
call does rather than implying a migration.

Fixes awslabs#493

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Mangesh Raut <95149253+mangeshraut712@users.noreply.github.com>

@sromoam sromoam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mangeshraut712. I checked on ba8747d6 and on current dev: the documented module= filter leaves the DeprecationWarning in place, and your message= filter silences it.

This does what #493 asked. #504 fixes the same issue and is already approved, though, and it also covers what the text I proposed in #493 missed. I reproduced each of these on this head:

  • The same call also emits a UserWarning ("Single-document confidence metrics are a quick sanity check..."). With only this filter installed, it still prints on every call under -W always and raises on every call under -W error (3 of 3 calls each).
  • Under pytest, the filter doesn't apply when set at import time. In a conftest.py, pytest's per-test filters override it and the DeprecationWarning still shows in the warnings summary. #504 adds the pytest filterwarnings config form.
  • "Once per process" (confidence-evaluation.md:131 and :143) only holds while the warning isn't an error. Under -W error::DeprecationWarning, 3 of 3 calls raise, because warn_once records the key only after the warning is emitted (src/stickler/utils/deprecation.py:39-44).
  • No [Unreleased] CHANGELOG entry. People pasted the old filter and it never worked, so this is a fix users can act on.

Both PRs rewrite the same section, so only one can merge. We'll land #504 for this issue and close this one when it does. Thanks for picking it up!

One heads-up: we're not merging anything outside the 1.1.0 milestone until 1.1.0 lands, so #504 will wait until after that, and this one stays open until then.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Closing in favour of #504, as reviewed — it covers the UserWarning, the pytest filterwarnings form, and the -W error case, none of which this filter reaches. Thanks for reproducing each of those.

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.

Fix the warnings filter that claims to silence the auroc_confidence_metric deprecation

2 participants