Skip to content

fix(template): run check.sh tools through the uv venv with python -m - #31

Merged
Andreas-Garcia merged 3 commits into
mainfrom
feature/uv-ci-contract
Dec 2, 2026
Merged

Andreas-Garcia merged 3 commits into
mainfrom
feature/uv-ci-contract

Conversation

@Andreas-Garcia

Copy link
Copy Markdown
Member

Summary

scripts/check.sh ran uv run --frozen pre-commit and pytest, which resolve through PATH and silently accept a global binary. They now run as python -m inside the uv venv, so the contract only passes when the tools are project dependencies.

Issues

Closes #30

Changes

  • template/scripts/check.sh.jinja: guard uv run --frozen python -c 'import pre_commit' (hint to add pre-commit to [dependency-groups] dev), then python -m pre_commit run --all-files and python -m pytest.
  • template/.github/workflows/lint.yml: same python -m pre_commit command, so CI lint and check.sh agree.
  • docs/migration-guide.md: first-adoption checklist for repos without .copier-answers.yml.
  • docs/development.md: link from "Validation contract" to the checklist.
  • scripts/tests/agent-template.sh: asserts the rendered check.sh commands and guard.

Test plan

  • bash scripts/tests/agent-template.sh <stub>: passes (copier render and actionlint). The CI invocation needs the external check-project-agents.py, replaced by a no-op stub locally.
  • Independent review: no important findings. Two minor ones fixed (guard no longer hides uv errors, lint.yml aligned). Not fixed: python -m pytest puts the cwd on sys.path, which can mask a broken install in flat-layout repos.
  • check.sh itself was not executed against a consumer repo.

Screenshots

N/A

Risk

Intent change, depth standard: shell template behavior shipped to consumers. Consumers whose dev group lacks pre-commit now fail check.sh after copier update, which is the intended fix.

How to revert

Revert the squash commit; copier update restores the previous check.sh.

Deployment notes

Merging a fix: PR starts a release-please patch release automatically. Consumers pick it up with copier update.

Post-deploy verification

N/A

🤖 Generated with Claude Code

Andreas-Garcia and others added 2 commits December 2, 2026 18:31
check.sh ran `uv run pre-commit`, which resolves through PATH and accepts a
global binary. Run pre-commit and pytest with `python -m` so only the project
venv counts, guard on pre-commit missing from dev dependencies, and document a
first-adoption checklist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Andreas-Garcia
Andreas-Garcia enabled auto-merge (squash) December 2, 2026 17:32
auto-merge was automatically disabled December 2, 2026 17:34

Pull request was closed

@Andreas-Garcia Andreas-Garcia reopened this Dec 2, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Andreas-Garcia
Andreas-Garcia merged commit cf93190 into main Dec 2, 2026
5 checks passed
@Andreas-Garcia
Andreas-Garcia deleted the feature/uv-ci-contract branch December 2, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document and guard first adoption of the uv validation contract in existing repos

1 participant