- Source:
src/(core modules likeamazon_dash.py,action.py,google_*,ifttt.py,openhab.py,models.py). - Tests:
tests/(test_*.py, uses pytest; doctests enabled viapytest.ini). - Docs:
docs/+mkdocs.yml(API docs built from docstrings viascripts/build-docs.sh). - Scripts:
scripts/(versioning, docs, requirements, local run helper). - Private config:
amazon-dash-private/(not committed; holdssettings.json,buttons.json, credentials).
./activate.sh: Create/activate local venv (Python 3.12) and install dev deps.make help: List available Make targets.make check: Run static checks (pre-commit/ruff/pyrefly viasniff_check.py).python -m pytest -vv --cov=src tests/: Run tests with coverage (CI mirrors this).make docsorscripts/build-docs.sh: Generate docs tosite/anddocs/docstrings/.- Docker (Linux):
docker run --net host -v $PWD/../amazon-dash-private:/amazon-dash-private:ro andgineer/amazon-dash-button-hack. - Local run (Mac/Windows):
. ./activate.sh && sudo python src/amazon_dash.py.
- Python ≥ 3.10 (CI targets 3.10–3.12).
- Linting/formatting:
ruff(line length ~100, double-quoted docstrings), run via pre-commit. - Types:
pyrefly(prefer precise annotations insrc/). - Naming: modules and functions
snake_case, classesPascalCase, constantsUPPER_SNAKE_CASE.
- Frameworks:
pytest,pytest-mock,freezegun; doctests enabled. - Naming:
tests/test_*.py; keep tests deterministic and isolated. - Coverage: Aim ≥85% (CI enforces green threshold). Run
pytest --cov=srclocally.
- Commits: short imperative descriptions (project history favors concise lowercase lines).
- Before PR: run
pre-commit run --all-files,pytest -vv --cov=src, andmake docsif APIs changed. - PRs must include: clear description, linked issues, configuration notes (if touching
amazon-dash-privateformats), and screenshots/logs when relevant. - Keep PRs small and focused; update
README.md/docs/when behavior or settings change.
- Never commit secrets. Place
settings.json,buttons.json, Google credentials, and IFTTT key underamazon-dash-private/and mount read-only in Docker. - Validate settings with
src/models.pyschemas; usebounce_delayto avoid duplicate press events.