Fix deprecation warnings from the frame serializer - #31
Merged
Conversation
The serializer read each field twice, once to test it for `None` and once for its value. Fields that intercept reads to warn about deprecation -- `StartFrame.audio_in_sample_rate` and its siblings -- emitted warnings on every frame walked. Read the raw instance state via `object.__getattribute__` instead, and skip dataclass types so only instances are serialized.
markbackman
added a commit
that referenced
this pull request
Aug 19, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
markbackman
force-pushed
the
mb/serializer-deprecation-warnings
branch
from
August 19, 2026 15:16
d59b091 to
adbb160
Compare
aconchillo
approved these changes
Aug 19, 2026
Contributor
|
LGTM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every frame observed by Whisker emitted a burst of
DeprecationWarnings — a dozen perStartFrame, repeated at each processor hop, unbounded and unsuppressable.Two causes combined:
StartFrameintercepts reads of its migrated configuration fields (audio_in_sample_rateand six siblings) and warns on each read.whisker_obj_serializerwalks every dataclass field of every frame, and read each field twice — once to test it forNone, once for its value.The serializer now builds the field map in one pass, from raw instance state:
object.__getattribute__returns the same value while bypassing the interception, so serialized payloads are unchanged. A debug tool rendering a field shouldn't trip a notice aimed at callers using it.Suppressing the warnings instead does not work: Pipecat raises them inside its own
catch_warnings()+simplefilter("always"), which replaces the caller's filters for the duration of the call — asimplefilter("ignore")around serialization has no effect. The read has to be avoided, not silenced.Also here:
not isinstance(obj, type).is_dataclass()is true for dataclass classes as well as instances, andobject.__getattribute__doesn't behave likegetattron a class. Such a value now serializes as<type: type>rather than its class-level defaults; no frame field is known to hold one..env*toui/.gitignore.Related Pipecat change
This clears the warnings for anyone running both packages. A companion Pipecat change makes the deprecation warn once per call site instead of on every read, which bounds the same flood for users on older Whisker versions and for any other caller that reflects over frame fields. Not required by this PR.
Test plan
Whisker has no test suite, so
whisker_obj_serializerwas exercised directly:StartFrames serialized against a Pipecat build carrying the deprecation shim: 0 warnings, against 600 before the change.StartFrameandTextFramepayloads compared before and after: identical.uv run ruff check src/anduv run ruff format --check src/clean.🤖 Generated with Claude Code