Thank you for contributing. This guide covers the essentials.
This project has a clear AI policy — read AI_POLICY.md and follow it. You're responsible for everything you submit.
git clone <repo-url>
cd switcher_webapi
uv sync --no-install-project --group dev --group docsSee AGENTS.md for linting, testing, and build commands.
- Define an endpoint path constant at module level in
app/webapp.py - Write the handler — it must be
async defand returnweb.Response - The handler extracts
device_type,ip,id, and optionallogin_keyfrom query params - Open
SwitcherApias an async context manager, call the appropriate aioswitcher method, and return the serialized result - Register the route with the matching
@routes.get/@routes.post/@routes.patch/@routes.deletedecorator - Add tests — mock aioswitcher and test with the
api_clientfixture
This project uses prek (pre-commit replacement) to run lint and format checks automatically before each commit.
uv run prek installThis installs the Git hook. After that, checks run automatically on every commit. To run them manually against all files:
uv run prek run --all-files- Conventional commits:
feat:,fix:,docs:,chore:,refactor:,test: - One logical change per commit
- Branch from
devwith a conventional name:feat/add-endpoint,fix/health-check - Commit with a descriptive message
- Run all checks before submitting:
uv run ruff check --fix && uv run ruff format && uv run ty check && uv run pytest -v --cov - Open PR against
devwith a clear description of what changed and why - Address feedback