|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +A Cookiecutter template for Python packages, supporting both CLI and library project types. Generates projects with uv, ruff, pyright, and pytest pre-configured. It also comes with GitHub Actions workflows configured for the project. |
| 6 | + |
| 7 | +This template is opinionated and enforces recommended practices when creating new Python projects. |
| 8 | + |
| 9 | +## Repository Structure |
| 10 | + |
| 11 | +- `{{cookiecutter.project_slug}}/` - Template directory (rendered by Cookiecutter) |
| 12 | +- `cookiecutter.json` - Template variables and prompts |
| 13 | +- `hooks/` - Pre/post generation scripts |
| 14 | + - `pre_gen_project.py` - Validates inputs (namespace, slug, entry point) |
| 15 | + - `post_gen_project.py` - Cleans up unused files based on options |
| 16 | + |
| 17 | +## Key Template Variables |
| 18 | + |
| 19 | +| Variable | Purpose | |
| 20 | +|----------|---------| |
| 21 | +| `project_name` | Human-readable name | |
| 22 | +| `project_slug` | Pip/repo name (auto-derived) | |
| 23 | +| `project_namespace_import` | Optional namespace (e.g., `company.tools`) | |
| 24 | +| `repo_type` | `CLI` or `library` | |
| 25 | +| `entry_point` | CLI command name (CLI only) | |
| 26 | + |
| 27 | +## Testing Changes |
| 28 | + |
| 29 | +Generate a test project to verify template changes: |
| 30 | + |
| 31 | +```bash |
| 32 | +# Generate in temp directory |
| 33 | +uvx cookiecutter -o /tmp . |
| 34 | + |
| 35 | +# Or with specific options (no prompts) |
| 36 | +uvx cookiecutter --no-input -o /tmp . project_name="Test Project" repo_type="CLI" |
| 37 | +``` |
| 38 | + |
| 39 | +Then verify the generated project: |
| 40 | + |
| 41 | +```bash |
| 42 | +cd /tmp/test-project |
| 43 | +make lint && make test |
| 44 | +``` |
| 45 | + |
| 46 | +## Verification |
| 47 | + |
| 48 | +When modifying the template: |
| 49 | + |
| 50 | +1. Ensure Jinja2 syntax is valid in template files |
| 51 | +2. Test both `CLI` and `library` repo types |
| 52 | +3. Test with and without `project_namespace_import` |
| 53 | +4. Verify generated project passes `make lint && make test` |
| 54 | + |
| 55 | +## Commit Messages |
| 56 | + |
| 57 | +- Summary line: max 50 chars (hard limit 72) |
| 58 | +- Body lines: max 72 chars |
| 59 | +- Use Markdown formatting in description |
0 commit comments