Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# AGENTS.md

## Project Overview

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.

This template is opinionated and enforces recommended practices when creating new Python projects.

## Repository Structure

- `{{cookiecutter.project_slug}}/` - Template directory (rendered by Cookiecutter)
- `cookiecutter.json` - Template variables and prompts
- `hooks/` - Pre/post generation scripts
- `pre_gen_project.py` - Validates inputs (namespace, slug, entry point)
- `post_gen_project.py` - Cleans up unused files based on options

## Key Template Variables

| Variable | Purpose |
|----------|---------|
| `project_name` | Human-readable name |
| `project_slug` | Pip/repo name (auto-derived) |
| `project_namespace_import` | Optional namespace (e.g., `company.tools`) |
| `repo_type` | `CLI` or `library` |
| `entry_point` | CLI command name (CLI only) |

## Testing Changes

Generate a test project to verify template changes:

```bash
# Generate in temp directory
uvx cookiecutter -o /tmp .

# Or with specific options (no prompts)
uvx cookiecutter --no-input -o /tmp . project_name="Test Project" repo_type="CLI"
```

Then verify the generated project:

```bash
cd /tmp/test-project
make lint && make test
```

## Verification

When modifying the template:

1. Ensure Jinja2 syntax is valid in template files
2. Test both `CLI` and `library` repo types
3. Test with and without `project_namespace_import`
4. Verify generated project passes `make lint && make test`

## Commit Messages

- Summary line: max 50 chars (hard limit 72)
- Body lines: max 72 chars
- Use Markdown formatting in description
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
49 changes: 49 additions & 0 deletions {{cookiecutter.project_slug}}/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# AGENTS.md

## Project Overview

{{ cookiecutter.project_description }}

{%- if cookiecutter.repo_type == 'CLI' %}
This is a command-line application with entry point `{{ cookiecutter.entry_point }}`.
{%- else %}
This is a Python library package.
{%- endif %}

## Stack

- Package manager: uv
- Build backend: uv_build
- Linting/formatting: ruff
- Type checking: pyright
- Testing: pytest
- CI: GitHub Actions (lint, test, release{%- if cookiecutter.documentation != 'none' %}, docs{%- endif %})

## Commands

Use Makefile targets, not tool commands directly:

- `make format` - Fix formatting issues
- `make lint` - Run all static checks (ruff, pyright)
- `make test` - Run tests with coverage
- `make doc` - Generate documentation
- `make build` - Build the package
{%- if cookiecutter.entry_point %}
- `make run` - Run the CLI (use `ARGS="..."` for arguments)
{%- endif %}

## Verification

Run `make lint && make test` before committing.

## Commit Messages

- Summary line: max 50 chars (hard limit 72)
- Body lines: max 72 chars
- Use Markdown formatting in description
- Reference issues where relevant (e.g., `See #123`)

## Project Layout

- `src/{{ cookiecutter.__project_import.replace('.', '/') }}/` - Source code
- `test/` - Test files
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md