- Add FastAPI application with complete router structure - Implement search, articles, ask, feedback, and health endpoints - Add comprehensive Pydantic schemas for API requests/responses - Include stub service implementations for all business logic - Add full test suite with pytest-asyncio integration - Configure conventional commits enforcement via git hooks - Add project documentation and contribution guidelines - Support both OpenAI and Gemini LLM integration options
1.7 KiB
1.7 KiB
Repository Copilot Instructions
This repository is a Python 3.11 FastAPI service. Copilot suggestions should follow these rules:
- Project scope: limit code suggestions to
apps/api/src/news_api/unless asked to add infra or tooling. - Imports: prefer stdlib → third-party → local (blank line between groups).
- Types: include type hints for public functions and methods; use Pydantic models for request/response shapes.
- FastAPI patterns: always use
response_modelon routers, async endpoints when I/O is involved, and router prefix/v1. - Tests: include pytest async tests using
pytest.mark.anyioandhttpx.AsyncClient; run tests withuv run pytest. - Small diffs: prefer minimal, focussed changes; do not refactor unrelated files.
- OpenSpec: for feature or breaking changes, reference
openspec/AGENTS.mdand suggest a change proposal before large design/code work. - No new top-level dependencies without justification and an openspec proposal.
- Docstrings: add concise docstrings to public functions/classes. Do not add license headers.
- Secrets: never suggest committing secrets or .env values; recommend using env vars or vault.
- Error handling: follow existing patterns; surface errors clearly and keep tests deterministic (pytest treats warnings as errors for
news_api.*). - Naming: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants.
- When suggesting code changes, include or update tests and schema changes as needed and mention the commands to run (
uv sync,uv run pytest).
If unsure about scope or a breaking change, ask for clarification and propose an openspec change-id. Please keep suggestions minimal and documented.