Repository navigation
docs: silence the AUROC deprecation warning by message, not module - #692
mangeshraut712 wants to merge 1 commit into
Conversation
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
left a comment
There was a problem hiding this comment.
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 alwaysand 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 theDeprecationWarningstill shows in the warnings summary. #504 adds the pytestfilterwarningsconfig form. - "Once per process" (
confidence-evaluation.md:131and:143) only holds while the warning isn't an error. Under-W error::DeprecationWarning, 3 of 3 calls raise, becausewarn_oncerecords 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.
|
Closing in favour of #504, as reviewed — it covers the |
Fixes #493
Problem
"Silencing the legacy AUROC deprecation warning" (
Guides/Evaluation/confidence-evaluation.md) filters bymodule="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)underwarnings.catch_warnings(record=True):DeprecationWarnings recordedmodule=(ondev)message=The warning text, for the record:
The 'auroc_confidence_metric' result key is deprecated; use result['confidence_metrics']['overall']['auroc']['value'] instead. …DeprecationWarningpython docs/check_links.py— exit 0, documentation buildsruff checkclean (no Python files change in this PR)One note on the filter's position, since it tripped my first check:
filterwarningsprepends, so awarnings.simplefilter("always")issued after installing this filter shadows it. That is standardwarningsordering and applies to anyignorerule, so I left it out of the page.