Skip to content

pre-commit: 12 code_templates/*.py files fail Python-parse hooks (check-ast, ruff-format) #214

Description

@scottschreckengaust

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions