awslabs / awslabs/agent-plugins
pre-commit: 12 `code_templates/*.py` files fail Python-parse hooks (check-ast, ruff-format)
- Dominant language
- Python
- Stars
- 893
- Forks
- 155
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 7
Description
Part of #213.
## Problem
Twelve `code_templates/*.py` files under `plugins/sagemaker-ai/skills/` are intentionally non-runnable templates (they contain placeholder/templating syntax that is not valid Python). As a result they fail every pre-commit hook that parses Python:
- `check-ast` — Failed
- `check-builtin-literals` — Failed
- `debug-statements` — Failed
- `ruff-format` — Failed (`error: Failed to parse ...`)
## Affected files
```
plugins/sagemaker-ai/skills/dataset-transformation/code_templates/transformation.py
plugins/sagemaker-ai/skills/finetuning/code_templates/dpo.py
plugins/sagemaker-ai/skills/finetuning/code_templates/rlaif_builtin.py
plugins/sagemaker-ai/skills/finetuning/code_templates/rlaif_custom_prompt.py
plugins/sagemaker-ai/skills/finetuning/code_templates/rlvr.py
plugins/sagemaker-ai/skills/finetuning/code_templates/sft.py
plugins/sagemaker-ai/skills/model-deployment/code_templates/deploy-nova-bedrock.py
plugins/sagemaker-ai/skills/model-deployment/code_templates/deploy-nova-sagemaker.py
plugins/sagemaker-ai/skills/model-deployment/code_templates/deploy-oss-bedrock.py
plugins/sagemaker-ai/skills/model-deployment/code_templates/deploy-oss-sagemaker.py
plugins/sagemaker-ai/skills/model-evaluation/code_templates/custom_scorer_evaluator.py
plugins/sagemaker-ai/skills/model-evaluation/code_templates/llmaaj_evaluator.py
```
## Reproduce
```bash
mise exec -- pre-commit run check-ast --all-files
```
## Proposed fix
Exclude `**/code_templates/**` from the Python-parsing hooks (`check-ast`, `check-builtin-literals`, `debug-statements`, `ruff`) in `.pre-commit-config.yaml`, since these files are documentation templates rather than importable modules. Alternatively, rename them to a non-`.py` extension if they are never meant to be executed.
Filed with assistance from Claude Code while implementing #211.
Contributor guide
Research direction
Open .pre-commit-config.yaml and inspect the check-ast, check-builtin-literals, debug-statements, and ruff hook file patterns. Reproduce with `mise exec -- pre-commit run check-ast --all-files`, then confirm the twelve listed templates no longer trigger Python-parsing hooks while ordinary Python files still do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100