Files
desklock/gateway/pyproject.toml
T
jpmschweitzerandClaude 8bdf950fcf
Test, Build and Push / test-gateway (push) Successful in 11s
Test, Build and Push / release (push) Skipped
Test, Build and Push / build-gateway (push) Skipped
build(lint): select ruff's rules explicitly instead of inheriting them
The gate had no `select`, so it linted with whatever the installed ruff
version defaults to. `dev` pins only `ruff>=0.6` and CI installs that
extra fresh on every run, which made the rule set a function of when pip
last resolved rather than of this code. Two developers on one commit
could get different answers, and so could CI and a laptop.

This surfaced when T-47's converged setup reinstalled ruff and pulled
0.16.3: `make lint` failed on UP017 and BLE001 in main.py, a file the
commit before it had not touched. Under the previous install the same
code passed. Nothing about the code changed — only the linter's idea of
what to look at, which had grown to 413 rules with nobody choosing them.

Naming the families fixes that; pinning the version would only have
frozen the symptom and moved the surprise to whoever unpinned it. 217
rules now, selected on purpose, and a future ruff release becomes a
decision instead of a broken push.

ASYNC is included deliberately — this is a websocket gateway, and it is
the family whose findings would be real bugs rather than style. BLE is
deliberately excluded: main.py catches bare Exception when a device
disappears mid-send, which is correct there, and selecting BLE would
mean a noqa on every such site to say so.

UP017 is fixed rather than suppressed (datetime.timezone.utc -> UTC,
identical semantics, and requires-python is already >=3.11); isort then
reordered the import, which is the whole of the main.py diff.

Verified the selection is load-bearing rather than decorative: a probe
file with a mutable default argument fails the explicit set (B006, exit
1) and passes ruff's minimal default set (exit 0), so the rules named
here are doing work the fallback would not. Probe deleted; lint,
typecheck and the 9-test suite all green after.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-17 12:36:37 +02:00

86 lines
2.9 KiB
TOML

[project]
name = "desklock-gateway"
version = "0.2.2"
description = "Voice gateway bridging the DeskLock device to the Tatlock butler (STT/chat/TTS)"
requires-python = ">=3.11"
dependencies = [
"fastapi>=0.115",
"uvicorn[standard]>=0.30",
"httpx>=0.27",
"pydantic-settings>=2.4",
]
[project.optional-dependencies]
speech = [
"faster-whisper>=1.0",
"piper-tts>=1.2",
]
dev = [
"pytest>=8.0",
"pytest-asyncio>=0.24",
"ruff>=0.6",
"mypy>=1.11",
]
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["src"]
[tool.ruff]
line-length = 100
src = ["src"]
# Selected explicitly, because the default set is not a constant.
#
# With no `select` here, ruff lints with whatever its installed version
# defaults to — 413 rules under 0.16.3. `dev` pins only `ruff>=0.6`, and CI
# installs that extra fresh on every run, so the gate's scope was a function of
# when pip last resolved rather than of this code. Two findings appeared here
# the first time a converged environment ran the gate, in a file nobody had
# touched (T-47).
#
# That is the failure this repo keeps meeting from the other side: a check
# whose result depends on something other than the thing it checks. Pinning the
# ruff version would freeze the symptom; naming the rules fixes it, and makes
# a future ruff release a decision rather than a surprise.
#
# ASYNC is here on purpose — this is a websocket gateway, and it is the one
# family whose findings would be genuine bugs rather than style.
# BLE (blind except) is deliberately absent: main.py catches bare Exception
# when a device disappears mid-send, which is correct there and would need a
# noqa on every occurrence to say so.
[tool.ruff.lint]
select = ["E", "W", "F", "I", "UP", "B", "ASYNC", "SIM", "C4"]
[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