Skip to content

Fix: Stop capturing warnings in thread workers - #374

Merged
tlambert03 merged 2 commits into
pyapp-kit:mainfrom
TimMonko:fix/drop-worker-warning-capture
Nov 22, 2026
Merged

tlambert03 merged 2 commits into
pyapp-kit:mainfrom
TimMonko:fix/drop-worker-warning-capture

Conversation

@TimMonko

Copy link
Copy Markdown
Contributor

References and Relevant Issues

Closes #371, follows on #365 and #366

Description

While a worker ran, superqt replaced warnings.showwarning and added an "always" filter for the whole process, so it could send the warning to the worker's warned signal. #371 found that this results in ignore filters stopped working while a worker is running. Instead of trying to "fix" all this behavior like in #365 and #366, this PR removes the capture entirely.

Raised warnings now go through the normal warnings.showwarning machienry and a user's fitlers apply.

While #371 (comment) describes how this warned signal is probably safe for complete removal, this keeps it as deprecated with a FutureWarning

Tested additionally that this is satisfactory (for napari) with

uv run --isolated --no-project --with "napari[qt] @ git+https://github.com/TimMonko/napari@fix/thread-worker-notifications" --with "superqt @ git+https://github.com/TimMonko/superqt@fix/drop-worker-warning-capture" https://raw.githubusercontent.com/TimMonko/napari/example/notifications/examples/message_routing.py

Workers no longer add an "always" filter or replace warnings.showwarning
while they run. Warnings raised in a worker now go through the normal
warnings machinery, so the user's filters apply (fixes pyapp-kit#371).

The `warned` signal is kept so existing connections don't break, but it
is never emitted and accessing it raises a FutureWarning.
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.90%. Comparing base (4e3c80a) to head (434e6db).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #374      +/-   ##
==========================================
- Coverage   85.04%   84.90%   -0.14%     
==========================================
  Files          49       49              
  Lines        3971     3935      -36     
==========================================
- Hits         3377     3341      -36     
  Misses        594      594              

☔ View full report in Codecov by Harness.
📢 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.

@tlambert03 tlambert03 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good by me @TimMonko! Thanks for following up on this. I'll give this a day or so for anyone else from napari to comment (if you want to ping them), but otherwise fine for merge

@tlambert03
tlambert03 merged commit 1c446d9 into pyapp-kit:main Nov 22, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Warnings are not properly filtered when workers are running

2 participants