chore: enable mypy disallow_untyped_defs for stackvox/#20
Merged
Conversation
Tightens the type bar so every function in stackvox/ has explicit param and return annotations. Tests stay on the looser config — pytest fixtures and pytest-mock's mocker are Any-heavy, and strict bans buy little there. Surfaced exactly one untyped function: the CoreAudio device-change callback in _start_device_watcher had `addrs` and `data` parameters without annotations. They're a ctypes.POINTER and a c_void_p we don't actually read — annotated as `Any` with a comment explaining why we ignore them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
b1662e2 to
3f6f6a3
Compare
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
Tightens the mypy bar so every function in `stackvox/` carries explicit param and return annotations. Tests stay on the looser config (`disallow_untyped_defs = false` per existing override) — pytest fixtures and pytest-mock's `mocker` are Any-heavy, and strict bans buy little there.
What it surfaced
Exactly one offender across the whole package: the CoreAudio device-change callback in `_start_device_watcher` had two unannotated ctypes parameters. Both are ignored at runtime — `addrs` is a `POINTER(_PropAddr)` and `data` is a `c_void_p` we don't read because only one property is registered and we re-read the device ID directly. Annotated as `Any` with a comment explaining why we ignore them.
Why bother
Now that the package is fully annotated and `py.typed` ships, downstream type checkers will believe our hints and flag mismatches. The strict-by-default posture means a future contributor can't quietly land a partially-typed module.
Test plan