mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-11 14:07:32 +01:00
The seventh and last app on the GitHub-repo transport. fetch_remote_alarm() is now `_fetch_firebase_alarm() or _fetch_github_alarm()`, so retiring the mirror later is deleting one branch and three constants. Two things made this look harder than it was. The first was the standing "_sync.py is stdlib-only" rule: crdt_sync pulls in requests, and the service runs /usr/bin/python rather than a venv. But the package already depends on gatelock and python-kasa, and _smart_plug.py already has the pattern for exactly this -- a module-scope import inside try/except ImportError. So the Firebase import is guarded the same way: a dependency that failed to install degrades the read to GitHub instead of killing the per-minute trigger. The GitHub path stays stdlib-only, which is what makes that fallback trustworthy. The second was the shutdown wrapper, which used to do its own authenticated GitHub read. It could not have worked against Firebase -- an ID token lasts about an hour and a shell script at shutdown time has no safe way to refresh one. It now reads the local alarm cache the trigger already keeps fresh (deployed to /usr/local/bin/shutdown), so the backend is invisible to it. install.sh also now refuses to run under sudo, which silently skipped its later steps. Verified against the live database, not just in tests: the phone's alarm is already published at wake-alarm-sync/devices/phone/alarm.json, and Firebase and GitHub both resolve it to 07:45. `_sync --show --no-cache` reports "07:45 (remote)" and the trigger dry-run behaves unchanged. 338 tests at 100% branch coverage, no new lint suppressions. The backend tests moved to test_sync_backends.py to keep both files under the 500-line cap. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017FH32BgGQbQLDstBhR26Xa
22 lines
780 B
Plaintext
22 lines
780 B
Plaintext
# Wake Alarm — runtime + development dependencies
|
|
# Runtime: tkinter/json/hmac/wave/subprocess (stdlib) plus gatelock,
|
|
# crdt-sync and python-kasa below. crdt-sync and python-kasa are both
|
|
# optional at runtime — their modules degrade gracefully if missing (the
|
|
# alarm read falls back to GitHub, smart-plug control disables itself) — but
|
|
# both are required here for mypy/pylint/tests.
|
|
bandit>=1.7.0
|
|
codespell>=2.2.0
|
|
coverage>=7.4.0
|
|
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.5.1#subdirectory=crdt-sync
|
|
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.4.0#subdirectory=gatelock
|
|
mypy>=1.8.0
|
|
pre-commit>=3.6.0
|
|
pylint>=3.0.0
|
|
pytest>=8.0.0
|
|
pytest-cov>=4.1.0
|
|
pytest-randomly>=3.15.0
|
|
pytest-sugar>=1.0.0
|
|
pytest-xdist>=3.5.0
|
|
python-kasa>=0.7
|
|
ruff>=0.8.0
|