Skip to content

Commit 657352c

Browse files
authored
Copier update: prepare for the prek migration (#113)
Pull in upstream template changes, tested in downstream repo <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Developer Tooling** * Updated pinned versions of Python and JavaScript tooling and added installation of `prek`. * Improved lock-file-only setup for JavaScript projects and refined validation output and CI failure reporting. * SHA tags are now limited to builds on the default branch. * **Configuration** * Updated template-managed settings and guidance to reflect current CI checks. * Restricted validation commands from selecting alternate configurations or repository locations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent dd58397 commit 657352c

28 files changed

Lines changed: 111 additions & 96 deletions

‎.claude/CLAUDE.md‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎.claude/settings/permissions/bash.jsonc‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"Bash(aws sts get*)",
2020
// Code Quality & Formatting
2121
"Bash(pre-commit run *)",
22+
"Bash(prek run *)",
2223
// Core Shell Commands
2324
"Bash(COMMAND *)", // used in slash commands
2425
"Bash(kill *)",
@@ -165,6 +166,16 @@
165166
"Bash(task --dir=*)",
166167
"Bash(task -g *)",
167168
"Bash(task --global *)",
169+
// Same reasoning for the hook runners: they must run the repo's own reviewed .pre-commit-config.yaml, and these flags are how to point them at another config or another repo
170+
"Bash(pre-commit run -c *)",
171+
"Bash(pre-commit run --config *)",
172+
"Bash(pre-commit run --config=*)",
173+
"Bash(prek run -c *)",
174+
"Bash(prek run --config *)",
175+
"Bash(prek run --config=*)",
176+
"Bash(prek run -C *)",
177+
"Bash(prek run --cd *)",
178+
"Bash(prek run --cd=*)",
168179

169180
// Destructive File Operations
170181
"Bash(chmod -R *)",

‎.coderabbit.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ reviews:
1313
- path: "**/vendor_files/**"
1414
instructions: "These files came from a vendor and we're not allowed to change them. Refer to it if you need to understand how the main code interacts with it, but do not make comments about it."
1515
- path: "**/*.py"
16-
instructions: "Never express concerns about potential ruff rule violations, even those rules mentioned in other agent instructions; a pre-commit hook already runs a ruff check. Do not warn about unnecessary super().__init__() calls; pyrefly prefers those to be present. Do not warn about missing type hints; a pre-commit hook already checks for that."
16+
instructions: "Never express concerns about potential ruff rule violations, even those rules mentioned in other agent instructions; the CI pipeline already runs a ruff check. Do not warn about unnecessary super().__init__() calls; pyrefly prefers those to be present. Do not warn about missing type hints; the CI pipeline already checks for that."
1717
- path: "**/.copier-answers.yml"
1818
instructions: "Do not comment about the `_commit` value needing to be a clean release tag. A CI job will fail if that is not the case."
1919
- path: ".config/.copier-managed-files.json"
@@ -26,11 +26,11 @@ reviews:
2626
appears in multiple entries, the last entry is the authoritative owner; use parent_src to
2727
trace the full chain and identify the correct template repo for backporting.
2828
tools:
29-
eslint: # when the code contains typescript, eslint will be run by pre-commit, and coderabbit often generates false positives
29+
eslint: # when the code contains typescript, eslint will be run in the CI pipeline, and coderabbit often generates false positives
3030
enabled: false
31-
ruff: # when the code contains python, ruff will be run by pre-commit, and coderabbit often generates false positives
31+
ruff: # when the code contains python, ruff will be run in the CI pipeline, and coderabbit often generates false positives
3232
enabled: false
33-
pylint: # when the code contains python, pylint will be run by pre-commit, and coderabbit often generates false positives
33+
pylint: # when the code contains python, pylint will be run in the CI pipeline, and coderabbit often generates false positives
3434
enabled: false
3535
flake8: # we use ruff instead (when we use Python)
3636
enabled: false

‎.config/.copier-answers.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.1.10
2+
_commit: v0.1.13
33
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
44
copier_answers_directory: .config
55
description: Copier template for creating Python libraries and executables

‎.config/.copier-managed-files.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
".claude/.beads/.gitignore",
77
".claude/.beads/config.yaml",
88
".claude/.beads/metadata.json",
9-
".claude/CLAUDE.md",
109
".claude/commands/add-command.md",
1110
".claude/commands/commit.md",
1211
".claude/commands/create-adr.md",
@@ -90,6 +89,7 @@
9089
".github/zizmor.yml",
9190
".gitignore",
9291
".pre-commit-config.yaml",
92+
".prekignore",
9393
".python-version",
9494
"AGENTS.md",
9595
"CHANGELOG.md",
@@ -113,7 +113,6 @@
113113
"template/.claude/.beads/.gitignore",
114114
"template/.claude/.beads/config.yaml",
115115
"template/.claude/.beads/metadata.json",
116-
"template/.claude/CLAUDE.md",
117116
"template/.claude/commands/add-command.md",
118117
"template/.claude/commands/commit.md",
119118
"template/.claude/commands/create-adr.md",

‎.devcontainer/devcontainer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@
6767
"initializeCommand": "sh .devcontainer/initialize-command.sh",
6868
"onCreateCommand": "sh .devcontainer/on-create-command.sh",
6969
"postStartCommand": "sh .devcontainer/post-start-command.sh"
70-
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): 0b1abb95 # spellchecker:disable-line
70+
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): 3db73231 # spellchecker:disable-line
7171
}

‎.devcontainer/install-ci-tooling.py‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
import tempfile
1515
from pathlib import Path
1616

17-
UV_VERSION = "0.12.15"
18-
PNPM_VERSION = "12.4.2"
17+
UV_VERSION = "0.12.23"
18+
PNPM_VERSION = "12.9.1"
1919
COPIER_VERSION = "==9.18.2"
2020
COPIER_TEMPLATE_EXTENSIONS_VERSION = "==0.3.3"
2121
PRE_COMMIT_VERSION = "==4.6.2"
2222
# identify decides which files each pre-commit hook runs on, so a floating version silently changes what CI checks
2323
IDENTIFY_VERSION = "==2.6.20"
24+
PREK_VERSION = "==0.5.5"
2425
TASK_VERSION = "==3.53.1"
2526
DOWNLOAD_TIMEOUT_SECONDS = 90
2627
# Where uv places both itself and the executables of the tools it installs. Resolves from USERPROFILE
@@ -282,6 +283,17 @@ def main():
282283
env=uv_env,
283284
timeout=DOWNLOAD_TIMEOUT_SECONDS,
284285
)
286+
_ = subprocess.run( # noqa: S603 # this is all our own input
287+
[
288+
uv_path,
289+
"tool",
290+
"install",
291+
f"prek{PREK_VERSION}",
292+
],
293+
check=True,
294+
env=uv_env,
295+
timeout=DOWNLOAD_TIMEOUT_SECONDS,
296+
)
285297
if not args.no_node:
286298
run_node_cmds(["npm -v", f"npm install -g pnpm@{PNPM_VERSION}", "pnpm -v"], is_windows=is_windows)
287299
# Task is installed outside the --no-node branch because CI always passes --no-node (pnpm/setup handles pnpm there), and every job still needs the task runner

‎.devcontainer/manual-setup-deps.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def main(): # noqa: C901,PLR0912,PLR0915 # TODO: cleanup into some subfunctions
169169
pnpm_command = ["pnpm", "install", "--dir", str(env.path)]
170170
if env_check_lock:
171171
pnpm_command[1] = "ci"
172+
if generate_lock_file_only:
173+
pnpm_command.append("--lockfile-only")
172174
if is_windows:
173175
pwsh = shutil.which("pwsh") or shutil.which("powershell")
174176
if not pwsh:

‎.github/actions/install_deps/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ runs:
9292
uses: pnpm/setup@v2.1.0
9393
with:
9494
# an empty version makes pnpm/setup read it from the manifest in working-directory instead. Passing both a version and a package.json with a conflicting `packageManager` field is a hard error in pnpm/setup.
95-
version: ${{ inputs.working-directory == 'notUsing' && '12.4.2' || '' }}
95+
version: ${{ inputs.working-directory == 'notUsing' && '12.9.1' || '' }}
9696
working-directory: ${{ steps.pnpm-project.outputs.dir }}
9797
# cache-dependency-path is left at its default, which is the lock file inside working-directory -- the same one the probe above checks
9898
runtime: node@${{ inputs.node-version }}

‎.github/reusable_workflows/build-docker-image.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ jobs:
194194
tags: ${{ steps.calculate-build-context-hash.outputs.full_image_tag }}
195195

196196
- name: Add git sha tag
197-
if: ${{ inputs.push-role-name != 'no-push' }}
197+
if: ${{ inputs.push-role-name != 'no-push' && github.ref_name == github.event.repository.default_branch }} # feature branch CI runs would otherwise pile hundreds of sha tags onto an unchanged image
198198
run: |
199199
GIT_SHA_TAG="git-sha-${{ github.sha }}"
200200
if aws ecr describe-images --region ${{ steps.parse_ecr_url.outputs.aws_region }} --registry-id=${{ steps.parse_ecr_url.outputs.aws_account_id }} --repository-name=${{ inputs.image_name }} --image-ids imageTag="$GIT_SHA_TAG" > /dev/null 2>&1; then
201201
echo "Tag $GIT_SHA_TAG already exists in ECR, skipping"
202202
else
203203
aws ecr batch-get-image --registry-id=${{ steps.parse_ecr_url.outputs.aws_account_id }} --repository-name=${{ inputs.image_name }} --image-ids imageTag=${{ steps.calculate-build-context-hash.outputs.build_context_tag }} --query 'images[].imageManifest' --output text > manifest.json
204-
# Every job on the push path tags the git sha, and jobs that find their image already in ECR no longer serialize on the mutex,
204+
# Every default-branch job on the push path tags the git sha, and jobs that find their image already in ECR no longer serialize on the mutex,
205205
# so another job can apply this same tag between the check above and the put below. ECR reports that as
206206
# ImageAlreadyExistsException, which by definition means the tag already points at this exact manifest, so it is safe to ignore.
207207
# ImageTagAlreadyExistsException (a different manifest on an immutable repository) is a real conflict and still fails the step.

0 commit comments

Comments
 (0)