|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | + |
| 5 | +- Source lives in `src/pdfrest/`; expose public APIs via `__all__` and keep |
| 6 | + package metadata in `pyproject.toml`. |
| 7 | +- Tests sit in `tests/` mirroring the module layout (e.g., |
| 8 | + `tests/test_client.py`). |
| 9 | +- Workflow definitions are in `.github/workflows/`; adjust only when CI |
| 10 | + requirements change. |
| 11 | +- Documentation and contributor notes reside at the repo root (`README.md`, |
| 12 | + `AGENTS.md`). |
| 13 | + |
| 14 | +## Build, Test, and Development Commands |
| 15 | + |
| 16 | +- `uv sync --group dev` — create/update the virtual environment with lint, |
| 17 | + type-check, and test tooling. |
| 18 | +- `uv run pre-commit run --all-files` — enforce formatting and lint rules before |
| 19 | + pushing. |
| 20 | +- `uv run pytest` — execute the suite with the active interpreter. |
| 21 | +- `uv build` — produce wheels and sdists identical to the release workflow. |
| 22 | + |
| 23 | +## Coding Style & Naming Conventions |
| 24 | + |
| 25 | +- Target Python 3.9–3.13; use 4-space indentation and type hints for public |
| 26 | + APIs. |
| 27 | +- Black + isort (via ruff) enforce formatting; run through pre-commit prior to |
| 28 | + review. |
| 29 | +- Use `snake_case` for functions/modules, `PascalCase` for classes, and |
| 30 | + `UPPER_SNAKE_CASE` for constants. |
| 31 | +- Prefer `pathlib`, f-strings, and other modern stdlib features—pyupgrade rules |
| 32 | + will flag legacy code. |
| 33 | + |
| 34 | +## Testing Guidelines |
| 35 | + |
| 36 | +- Write pytest tests: files named `test_*.py`, test functions `test_*`, fixtures |
| 37 | + in `conftest.py` where shared. |
| 38 | +- Ensure high-value coverage of public functions and edge cases; document intent |
| 39 | + in test docstrings when non-obvious. |
| 40 | +- For interpreter compatibility, execute the matrix locally: |
| 41 | + ```bash |
| 42 | + for py in 3.9 3.10 3.11 3.12 3.13; do |
| 43 | + UV_PROJECT_ENVIRONMENT=.venv-$py uv sync --group dev --python $py |
| 44 | + UV_PROJECT_ENVIRONMENT=.venv-$py uv run --python $py pytest |
| 45 | + done |
| 46 | + ``` |
| 47 | + |
| 48 | +## Commit & Pull Request Guidelines |
| 49 | + |
| 50 | +- Follow the `area: summary` convention seen in `pdfassistant-chatbot` (e.g., |
| 51 | + `client: Add document merge service`). |
| 52 | +- Keep commit messages imperative and focused; squash fixups before opening a |
| 53 | + PR. |
| 54 | +- Reference related issues or tickets in the PR description, and highlight |
| 55 | + breaking changes. |
| 56 | +- Confirm CI passes (`pre-commit`, Python matrix) and note any manual |
| 57 | + verification or screenshots for behaviour updates. |
| 58 | + |
| 59 | +## CI & Publishing Notes |
| 60 | + |
| 61 | +- GitHub Actions run two workflows: `pre-commit` (no AWS credentials) and |
| 62 | + `Test and Publish` (Python 3.9–3.13 matrix). |
| 63 | +- Only the release job assumes the AWS OIDC role to `uv build` and publish with |
| 64 | + `uv tool run --from twine twine upload`. |
| 65 | +- Keep CodeArtifact credentials out of source control; day-to-day development |
| 66 | + should rely solely on public dependencies. |
0 commit comments