fix(gateway): tell mypy the speech extra may be absent
`make typecheck` failed on four missing stubs — piper, faster_whisper and numpy twice — which made the pre-push gate red on a machine that had followed the documented setup. `make setup` deliberately omits the speech extra; only `make setup-speech` installs it, because faster-whisper and piper-tts pull several GB of ML wheels for a backend the deployment does not use. settings.tts_backend defaults to "speaches", a network call to the shared service on 8601, and both imports are lazy inside the functions that need them. So the absence is a runtime fact the code already handles, not a defect. The gate was therefore failing for doing the right thing, which is how a gate stops being read. The correct assertion is "these modules may be absent", not "install several GB so the type checker is satisfied" — on a disk at 76%, for a path this deployment does not take. There was no [tool.mypy] section at all, so this adds one. numpy is listed for the same reason as the other two: nothing depends on it directly, it arrives with faster-whisper. Note the packaging was already correct — speech is an optional extra and always has been. I initially reported these as required dependencies that were missing from the venv, having grepped for the package names and read the hits without checking which table they sat under; `mypy>=1.11` was three lines below in the same output, which should have said "these are extras". CLAUDE.md states it outright. The fix is smaller than the one I first described because the repo was already doing the right thing. Gate now passes: secrets, ruff, mypy, 9 tests. Firmware and sim still report undetermined, which is accurate — neither has a suite. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -36,3 +36,28 @@ src = ["src"]
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
testpaths = ["tests"]
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.11"
|
||||
|
||||
# The speech extra is deliberately absent from a default setup. `make setup`
|
||||
# installs the gateway without it; `make setup-speech` adds faster-whisper and
|
||||
# piper-tts, which pull several GB of ML wheels for a backend the deployment
|
||||
# does not use — settings.tts_backend defaults to "speaches", a network call to
|
||||
# the shared service on 8601. Both imports are lazy, inside the functions that
|
||||
# need them, so their absence is a runtime fact rather than a defect.
|
||||
#
|
||||
# numpy is here for the same reason: nothing depends on it directly, it arrives
|
||||
# with faster-whisper.
|
||||
#
|
||||
# Without these overrides, `make typecheck` fails on a machine that followed the
|
||||
# documented setup — the pre-push gate turning red for doing the right thing,
|
||||
# which is how a gate stops being read (T-56). The right assertion is "these
|
||||
# modules may be absent", not "install several GB so the type checker is happy".
|
||||
[[tool.mypy.overrides]]
|
||||
module = [
|
||||
"piper", "piper.*",
|
||||
"faster_whisper", "faster_whisper.*",
|
||||
"numpy", "numpy.*",
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
|
||||
Reference in New Issue
Block a user