Skip to content

Commit 84ffc52

Browse files
committed
Expand AGENTS.md with project overview, structure, setup, and workflow sections
1 parent f851388 commit 84ffc52

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

AGENTS.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,132 @@
22

33
This file provides guidelines for AI coding agents (e.g., GitHub Copilot, Cursor, Codex) working in this repository.
44

5+
---
6+
7+
## Project Overview
8+
9+
This is a **Python project template** that provides a pre-configured, production-ready starting point for Python applications. It includes out-of-the-box support for:
10+
11+
- **Packaging & dependency management** via [Poetry](https://python-poetry.org)
12+
- **CLI** via [click](https://click.palletsprojects.com)
13+
- **Testing & coverage** via [pytest](https://pytest.org) and [coverage](https://coverage.readthedocs.io)
14+
- **Linting, formatting & import sorting** via [ruff](https://docs.astral.sh/ruff)
15+
- **Type checking** via [pyright](https://microsoft.github.io/pyright)
16+
- **Pre-commit hooks** via [pre-commit](https://pre-commit.com)
17+
- **Documentation** via [MkDocs](https://www.mkdocs.org) with [mkdocstrings](https://mkdocstrings.github.io), auto-deployed to GitHub Pages
18+
- **CI/CD** via GitHub Actions
19+
- **Containerisation** via Docker and Dev Containers
20+
21+
---
22+
23+
## Project Structure
24+
25+
```
26+
├── .devcontainer/ # Dev container configuration
27+
├── .github/ # GitHub-specific files (Actions, templates, Dependabot)
28+
├── .vscode/ # VS Code settings
29+
├── docs/ # Documentation source
30+
│ ├── README.md # Project README and MkDocs home page
31+
│ ├── CONTRIBUTING.md # Contributing guidelines
32+
│ └── reference/ # Auto-generated API reference pages
33+
├── project/ # Main source package (renamed via `make project`)
34+
│ ├── __init__.py
35+
│ └── app.py # CLI entry point
36+
├── tests/ # Test suite
37+
│ ├── conftest.py # Shared pytest fixtures and hooks
38+
│ └── test_app.py # Sample tests
39+
├── compose.yml # Docker Compose file
40+
├── Dockerfile # App container
41+
├── Makefile # Workflow automation targets
42+
├── mkdocs.yml # MkDocs configuration
43+
├── pyproject.toml # Project metadata, dependencies, and tool configuration
44+
└── poetry.lock # Locked dependency versions (do not edit manually)
45+
```
46+
47+
> **Note:** The `project/` folder is the template placeholder. After initialising a real project with `make project NAME=...`, it is renamed to the chosen package name.
48+
49+
---
50+
51+
## Setup
52+
53+
### Prerequisites
54+
55+
- Python 3.12+
56+
- [pipx](https://pipx.pypa.io) (to install Poetry)
57+
- Docker (for Dev Container or containerised runs)
58+
59+
### First-time setup
60+
61+
```bash
62+
# 1. Install Poetry (if not already installed)
63+
make poetry
64+
65+
# 2. Install all dependencies
66+
make install
67+
68+
# 3. Install pre-commit hooks
69+
make precommit
70+
71+
# 4. Activate the virtual environment
72+
make venv
73+
```
74+
75+
### Rename the template for a new project (run once)
76+
77+
```bash
78+
make project NAME="my-project" DESCRIPTION="My app" AUTHOR="Your Name" EMAIL="you@example.com" GITHUB="your-username"
79+
```
80+
81+
---
82+
83+
## Common Commands
84+
85+
| Task | Command |
86+
|---|---|
87+
| Install dependencies | `make install` |
88+
| Update dependencies | `make update` |
89+
| Lint and format | `make lint` |
90+
| Run tests with coverage | `make test` |
91+
| Run app locally | `app` (after `make venv`) or `poetry run app` |
92+
| Run app in Docker | `docker compose run app` |
93+
| Serve docs locally | `make local` |
94+
| Deploy docs to GitHub Pages | `make docs` |
95+
| Full setup from scratch | `make all` |
96+
97+
> Refer to `docs/README.md` for the full list of available targets. Add new targets to `Makefile` as needed.
98+
99+
---
100+
101+
## Code Style
102+
103+
- **Line length**: 120 characters (configured in `pyproject.toml` under `[tool.ruff]`)
104+
- **Linter/formatter**: `ruff` — enforces `E` (pycodestyle errors) and `I` (isort) rules
105+
- **Type checker**: `pyright` — all imports must resolve; missing imports are errors
106+
- **Pre-commit**: hooks run `ruff` automatically before every commit
107+
- Run `make lint` to format, sort imports, and check types manually
108+
- All public functions and classes must have docstrings (used by `mkdocstrings` for API docs)
109+
110+
---
111+
112+
## Testing
113+
114+
- Tests live in the `tests/` directory and mirror the source structure
115+
- Run the full test suite with coverage using `make test` (runs `pytest` via `coverage`)
116+
- Coverage is measured with branch coverage enabled; the report is printed to the terminal and exported as `coverage.xml`
117+
- Shared fixtures belong in `tests/conftest.py`
118+
- Test files must be named `test_*.py`
119+
120+
---
121+
122+
## Git Workflow
123+
124+
- Work on feature branches; open a pull request to `main`
125+
- Pre-commit hooks enforce formatting and linting on every commit
126+
- CI (`.github/workflows/check.yml`) runs lint and tests on every push
127+
- Do not commit directly to `main`
128+
129+
---
130+
5131
## Dependencies
6132

7133
- Always use Poetry for dependency management (`poetry add <package>`)

0 commit comments

Comments
 (0)