diff --git a/README.md b/README.md index 0a21cd8..ab557aa 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A simple modern Python project template powered by [Copier](https://copier.readthedocs.io/). -[Japanese Article](https://zenn.dev/mjun0812/articles/0ae2325d40ed20) +[Article](https://mjunya.com/en/posts/2025-06-15-python-template/) [日本語記事](https://zenn.dev/mjun0812/articles/0ae2325d40ed20) ## Features @@ -13,7 +13,7 @@ A simple modern Python project template powered by [Copier](https://copier.readt - 📦 **uv Package Manager**: Fast and reliable package management with [uv](https://github.com/astral-sh/uv) - 🐳 **Docker Support**: Complete Docker development environment - 📦 **Devcontainer Support**: VS Code devcontainer for consistent development -- ✨ **AI Editor Support**: [Cursor rules](https://docs.cursor.com/context/rules) and +- ✨ **AI Editor Support**: [AGENTS.md](https://agents.md) and [CLAUDE.md](https://docs.anthropic.com/en/docs/claude-code/overview) included for AI-powered development - 📝 **Type Hints**: Full type annotation support with modern Python features - 🔍 **Code Quality**: Pre-configured Ruff for linting and formatting @@ -109,8 +109,8 @@ your-project/ ## AI Editor Support -- [Cursor Rules](./template/.cursor/rules/coding_style.mdc) -- [CLAUDE.md](./template/CLAUDE.md) +- [AGENTS.md(`./template/AGENTS.md`)](https://agents.md) +- [CLAUDE.md(`./template/CLAUDE.md`)](https://docs.claude.com/en/docs/claude-code/memory#claude-md-imports) ## Q&A diff --git a/template/.devcontainer/devcontainer.json b/template/.devcontainer/devcontainer.json index cbc60d1..1494755 100644 --- a/template/.devcontainer/devcontainer.json +++ b/template/.devcontainer/devcontainer.json @@ -5,10 +5,11 @@ "DISPLAY": "${localEnv:DISPLAY}", "PYTHONUNBUFFERED": "1", "PYTHONDONTWRITEBYTECODE": "1", - "UV_CACHE_DIR": "${containerWorkspaceFolder}/.cache/uv", + "UV_CACHE_DIR": "/home/vscode/.cache/uv", "UV_LINK_MODE": "copy", "UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv", - "UV_COMPILE_BYTECODE": "1" + "UV_COMPILE_BYTECODE": "1", + "CLAUDE_CONFIG_DIR": "/home/vscode/.claude" }, "features": { "ghcr.io/devcontainers/features/github-cli:1": {}, @@ -16,7 +17,7 @@ "configureZshAsDefaultShell": true }, "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { - "packages": "curl,wget,git,jq,ca-certificates,build-essential,ripgrep" + "packages": "curl,wget,git,jq,ca-certificates,build-essential,ripgrep,fd-find" }, "ghcr.io/va-h/devcontainers-features/uv:1": { "shellAutocompletion": true @@ -46,9 +47,16 @@ ] } }, + "remoteUser": "vscode", + "containerUser": "vscode", + "initializeCommand": "mkdir -p ${localEnv:HOME}/.claude ${localEnv:HOME}/.codex && touch ${localEnv:HOME}/.claude/CLAUDE.md ${localEnv:HOME}/.codex/config.toml", "mounts": [ - "source=claude-code-config,target=/home/vscode/.claude,type=volume" + "source=shell_history-${devcontainerId},target=/shell_history,type=volume", + "source=${localEnv:HOME}/.claude,target=/home/vscode/.claude,type=bind", + "source=${localEnv:HOME}/.claude/CLAUDE.md,target=/home/vscode/.claude/CLAUDE.md,type=bind", + "source=${localEnv:HOME}/.codex,target=/home/vscode/.codex,type=bind", + "source=${localEnv:HOME}/.codex/config.toml,target=/home/vscode/.codex/config.toml,type=bind" ], - "postCreateCommand": "uv sync", + "postCreateCommand": "npm install -g @openai/codex@latest && uv sync", "postStartCommand": "uv run pre-commit install" } \ No newline at end of file diff --git a/template/.pre-commit-config.yaml b/template/.pre-commit-config.yaml index 579f83a..e67372f 100644 --- a/template/.pre-commit-config.yaml +++ b/template/.pre-commit-config.yaml @@ -1,12 +1,12 @@ repos: - repo: https://github.com/astral-sh/uv-pre-commit # uv version. - rev: 0.7.11 + rev: 0.8.22 hooks: - id: uv-lock - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.11.12 + rev: v0.13.2 hooks: # Run the linter. - id: ruff-check diff --git a/template/.cursor/rules/coding_style.mdc b/template/AGENTS.md similarity index 95% rename from template/.cursor/rules/coding_style.mdc rename to template/AGENTS.md index 4c54694..7e059fa 100644 --- a/template/.cursor/rules/coding_style.mdc +++ b/template/AGENTS.md @@ -1,8 +1,3 @@ ---- -description: -globs: -alwaysApply: true ---- # Development Guidelines This document contains critical information about working with this codebase. diff --git a/template/CLAUDE.md b/template/CLAUDE.md deleted file mode 100644 index 7e059fa..0000000 --- a/template/CLAUDE.md +++ /dev/null @@ -1,37 +0,0 @@ -# Development Guidelines - -This document contains critical information about working with this codebase. -Follow these guidelines precisely. - -## Rules - -1. Package Management - - ONLY use uv, NEVER pip - - Installation: `uv add package` - - Upgrading: `uv add --dev package --upgrade-package package` - - FORBIDDEN: `uv pip install`, `@latest` syntax - -2. Code Quality - - Type hints required for all code - - Follow existing patterns exactly - - Use Google style for docstring - -3. Testing Requirements - - Framework: `uv run --frozen pytest` - - Coverage: test edge cases and errors - - New features require tests - - Bug fixes require regression tests - -4. Git - - Follow the Conventional Commits style on commit messages. - -## Code Formatting and Linting - -1. Ruff - - Format: `uv run --frozen ruff format .` - - Check: `uv run --frozen ruff check .` - - Fix: `uv run --frozen ruff check . --fix` -2. Pre-commit - - Config: `.pre-commit-config.yaml` - - Runs: on git commit - - Tools: Ruff (Python) diff --git a/template/CLAUDE.md b/template/CLAUDE.md new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/template/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/template/pyproject.toml b/template/pyproject.toml index 1bd18d9..6296f36 100644 --- a/template/pyproject.toml +++ b/template/pyproject.toml @@ -64,7 +64,6 @@ ignore = [ "SIM105", # try-except-pass blocks that can be replaced with the contextlib.suppress context manager. "SIM108", # Use ternary operator instead of `if`-`else`-block "SIM116", # Use a dictionary instead of consecutive `if` statements - "UP038", # (Deprecated) Use `X | Y` in `isinstance` call instead of `(X, Y)` ] unfixable = [ "F401", # unused import