Skip to content

Commit 5c68b7d

Browse files
authored
Copier update: VCRpy (#81)
Pull in upstream template changes for VCRpy config <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Python asyncio configuration template option for async code support. * Added VCRpy test fixture support for recording and replaying HTTP requests in tests. * **Improvements** * Enhanced error tracking for background tasks in async tests. * Updated development tools, testing frameworks, and CI/CD actions to newer versions. * Improved development container setup and CI/CD workflow robustness with better error reporting. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 3ebc906 commit 5c68b7d

39 files changed

Lines changed: 360 additions & 174 deletions

‎.copier-answers.yml‎

Lines changed: 3 additions & 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.0.85
2+
_commit: v0.0.90
33
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
44
description: Copier template for creating Python libraries and executables
55
install_claude_cli: false
@@ -12,6 +12,8 @@ repo_org_name: LabAutomationAndScreening
1212
repo_org_name_for_copyright: Lab Automation & Screening
1313
ssh_port_number: 55874
1414
template_might_want_to_install_aws_ssm_port_forwarding_plugin: true
15+
template_might_want_to_use_python_asyncio: true
16+
template_might_want_to_use_vcrpy: true
1517
template_uses_javascript: false
1618
template_uses_pulumi: false
1719
template_uses_python: true

‎.devcontainer/devcontainer.json‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
"service": "devcontainer",
44
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
55
"features": {
6-
"ghcr.io/devcontainers/features/aws-cli:1.1.2": {
7-
// https://github.com/devcontainers/features/blob/main/src/aws-cli/devcontainer-feature.json
8-
// view latest version https://raw.githubusercontent.com/aws/aws-cli/v2/CHANGELOG.rst
9-
"version": "2.31.11"
10-
},
116
"ghcr.io/devcontainers/features/python:1.7.1": {
127
// https://github.com/devcontainers/features/blob/main/src/python/devcontainer-feature.json
138
"version": "3.12.7",
@@ -21,7 +16,7 @@
2116
"extensions": [
2217
// basic tooling
2318
// "eamodio.gitlens@15.5.1",
24-
"coderabbit.coderabbit-vscode@0.16.0",
19+
"coderabbit.coderabbit-vscode@0.16.1",
2520
"ms-vscode.live-server@0.5.2025051301",
2621
"MS-vsliveshare.vsliveshare@1.0.5905",
2722
"github.copilot@1.388.0",
@@ -63,5 +58,5 @@
6358
"initializeCommand": "sh .devcontainer/initialize-command.sh",
6459
"onCreateCommand": "sh .devcontainer/on-create-command.sh",
6560
"postStartCommand": "sh .devcontainer/post-start-command.sh"
66-
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): eeccb984 # spellchecker:disable-line
61+
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): 99b3f7c4 # spellchecker:disable-line
6762
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import tempfile
88
from pathlib import Path
99

10-
UV_VERSION = "0.9.11"
11-
PNPM_VERSION = "10.23.0"
10+
UV_VERSION = "0.9.17"
11+
PNPM_VERSION = "10.25.0"
1212
COPIER_VERSION = "9.11.0"
1313
COPIER_TEMPLATE_EXTENSIONS_VERSION = "0.3.3"
1414
PRE_COMMIT_VERSION = "4.5.0"

‎.devcontainer/windows-host-helper.sh‎

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,30 @@ repoName=$(basename "$gitUrl" .git)
2727

2828
echo "Repo name extracted as '$repoName'"
2929

30-
# Remove any existing subfolder with the repository name and recreate it
31-
rm -rf "./$repoName" || true # sometimes deleting the .venv folder fails
32-
rm -rf "./$repoName/*.md" # for some reason, sometimes md files are left behind
30+
sudo rm -rf "./$repoName" || true
31+
sudo rm -rf "./$repoName/*.md"
3332
mkdir -p "./$repoName"
33+
sudo chown -R "$(whoami):$(whoami)" "./$repoName" # TODO: see if this alone is enough to fix everything
3434

3535
# Create a temporary directory for cloning
3636
tmpdir=$(mktemp -d)
3737

38-
# Clone the repository into a subfolder inside the temporary directory.
39-
# This creates "$tmpdir/$repoName" with the repository's contents.
38+
# Clone the repository into a subfolder inside the temporary directory
4039
git clone "$gitUrl" "$tmpdir/$repoName"
4140

42-
43-
SRC="$(realpath "$tmpdir/$repoName")"
44-
DST="$(realpath "./$repoName")"
45-
46-
# 1) Recreate directory tree under $DST
47-
while IFS= read -r -d '' dir; do
48-
rel="${dir#$SRC/}" # strip leading $SRC/ → e.g. "sub/dir"
49-
mkdir -p "$DST/$rel"
50-
done < <(find "$SRC" -type d -print0)
51-
52-
# 2) Move all files into that mirror
53-
while IFS= read -r -d '' file; do
54-
rel="${file#$SRC/}" # e.g. "sub/dir/file.txt"
55-
# ensure parent exists (though step 1 already did)
56-
mkdir -p "$(dirname "$DST/$rel")"
57-
mv "$file" "$DST/$rel"
58-
done < <(find "$SRC" -type f -print0)
59-
60-
# 3) Clean up now‑empty dirs and the tmp clone
61-
find "$SRC" -depth -type d -empty -delete
41+
# Use rsync to merge all contents (including hidden files) from cloned repo to target
42+
# -a: archive mode (preserves permissions, timestamps, etc.)
43+
# -v: verbose
44+
# --exclude: skip volume mount directories that should not be overwritten
45+
echo "Syncing repository contents..."
46+
rsync -av \
47+
--exclude='node_modules' \
48+
--exclude='.pnpm-store' \
49+
--exclude='.venv' \
50+
"$tmpdir/$repoName/" "./$repoName/"
51+
52+
# Clean up: remove the temporary directory
6253
rm -rf "$tmpdir"
6354

64-
echo "Repository '$repoName' has been synced into '$DST'."
55+
echo "Repository '$repoName' has been updated."
56+
echo "Note: Volume mounts (node_modules, .pnpm-store, .venv) were preserved."

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ runs:
5858

5959
- name: Setup python
6060
if: ${{ inputs.python-version != 'notUsing' }}
61-
uses: actions/setup-python@v6.0.0
61+
uses: actions/setup-python@v6.1.0
6262
with:
6363
python-version: ${{ env.PYTHON_VERSION }}
6464

6565
- name: Setup node
6666
if: ${{ inputs.node-version != 'notUsing' }}
67-
uses: actions/setup-node@v6.0.0
67+
uses: actions/setup-node@v6.1.0
6868
with:
6969
node-version: ${{ inputs.node-version }}
7070

@@ -75,7 +75,7 @@ runs:
7575

7676
- name: OIDC Auth for CodeArtifact
7777
if: ${{ inputs.code-artifact-auth-role-name != 'no-code-artifact' }}
78-
uses: aws-actions/configure-aws-credentials@v5.1.0
78+
uses: aws-actions/configure-aws-credentials@v5.1.1
7979
with:
8080
role-to-assume: arn:aws:iam::${{ inputs.code-artifact-auth-role-account-id }}:role/${{ inputs.code-artifact-auth-role-name }}
8181
aws-region: ${{ inputs.code-artifact-auth-region }}

‎.github/actions/update-devcontainer-hash/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ runs:
2727
shell: bash
2828

2929
- name: Checkout code
30-
uses: actions/checkout@v5.0.0
30+
uses: actions/checkout@v6.0.1
3131
with:
3232
persist-credentials: true
3333
fetch-depth: 1

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ jobs:
6666
shell: bash
6767

6868
- name: Checkout code
69-
uses: actions/checkout@v5.0.0
69+
uses: actions/checkout@v6.0.1
7070
with:
7171
persist-credentials: false
7272

7373
- name: OIDC Auth for ECR
7474
if: ${{ inputs.push-role-name != 'no-push' }}
75-
uses: aws-actions/configure-aws-credentials@v5.1.0
75+
uses: aws-actions/configure-aws-credentials@v5.1.1
7676
with:
7777
role-to-assume: arn:aws:iam::${{ steps.parse_ecr_url.outputs.aws_account_id }}:role/${{ inputs.push-role-name }}
7878
aws-region: ${{ steps.parse_ecr_url.outputs.aws_region }}

‎.github/workflows/ci.yaml‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
contents: write # needed for updating dependabot branches
2121

2222
pre-commit:
23-
needs: [ get-values ]
23+
needs:
24+
- get-values
2425
uses: ./.github/workflows/pre-commit.yaml
2526
permissions:
2627
contents: write # needed for mutex
@@ -29,7 +30,8 @@ jobs:
2930
python-version: 3.12.7
3031

3132
lint-matrix:
32-
needs: [ pre-commit ]
33+
needs:
34+
- pre-commit
3335
strategy:
3436
matrix:
3537
os:
@@ -54,7 +56,7 @@ jobs:
5456

5557
steps:
5658
- name: Checkout code
57-
uses: actions/checkout@v5.0.0
59+
uses: actions/checkout@v6.0.1
5860
with:
5961
persist-credentials: false
6062

@@ -111,7 +113,7 @@ jobs:
111113
timeout-minutes: 8 # this is the amount of time this action will wait to attempt to acquire the mutex lock before failing, e.g. if other jobs are queued up in front of it
112114

113115
- name: Cache Pre-commit hooks
114-
uses: actions/cache@v4.2.4
116+
uses: actions/cache@v4.3.0
115117
env:
116118
cache-name: cache-pre-commit-hooks
117119
with:
@@ -123,7 +125,13 @@ jobs:
123125
- name: Run pre-commit
124126
run: |
125127
# skip devcontainer context hash because the template instantiation may make it different every time
126-
SKIP=git-dirty,compute-devcontainer-context-hash pre-commit run -a
128+
SKIP=git-dirty,compute-devcontainer-context-hash pre-commit run -a || PRE_COMMIT_EXIT_CODE=$?
129+
if [ -n "$PRE_COMMIT_EXIT_CODE" ]; then
130+
echo "Pre-commit failed with exit code $PRE_COMMIT_EXIT_CODE"
131+
echo "Showing git diff:"
132+
git --no-pager diff
133+
exit $PRE_COMMIT_EXIT_CODE
134+
fi
127135
128136
- name: Upload pre-commit log if failure
129137
if: ${{ failure() }}
@@ -135,7 +143,9 @@ jobs:
135143
required-check:
136144
runs-on: ubuntu-24.04
137145
timeout-minutes: 2
138-
needs: [ lint-matrix, get-values ]
146+
needs:
147+
- lint-matrix
148+
- get-values
139149
permissions:
140150
statuses: write # needed for updating status on Dependabot PRs
141151
if: always()

‎.github/workflows/get-values.yaml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
dependabot-commit-created:
1010
description: whether or not a commit was created on a dependabot branch
1111
value: ${{ jobs.get-values.outputs.dependabot-commit-created }}
12+
pr-short-num:
13+
description: the last two digits of the PR number (to be used for fixed width naming, like Pulumi stacks)
14+
value: ${{ jobs.get-values.outputs.pr-short-num }}
1215

1316
env:
1417
PYTHONUNBUFFERED: True
@@ -32,7 +35,7 @@ jobs:
3235
JSON
3336
3437
- name: Checkout code
35-
uses: actions/checkout@v5.0.0
38+
uses: actions/checkout@v6.0.1
3639
with:
3740
persist-credentials: false
3841

‎.github/workflows/hash_git_files.py‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,16 @@ def compute_adler32(repo_path: Path, files: list[str]) -> int:
6565
if not chunk:
6666
break
6767
checksum = zlib.adler32(chunk, checksum)
68-
except Exception as e:
69-
if "[Errno 21] Is a directory" in str(e):
70-
# Ignore symlinks that on windows sometimes get confused as being directories
71-
continue
72-
print(f"Error reading file {file}: {e}", file=sys.stderr) # noqa: T201 # this just runs as a simple script, so using print instead of log
73-
raise
68+
except IsADirectoryError:
69+
# Ignore symlinks that on windows sometimes get confused as being directories
70+
continue
7471

7572
return checksum
7673

7774

7875
def find_devcontainer_hash_line(lines: list[str]) -> tuple[int, str | None]:
7976
"""Find the line index and current hash in the devcontainer.json file."""
80-
for i in range(len(lines) - 1, -1, -1):
77+
for i in reversed(range(len(lines))):
8178
if lines[i].strip() == "}":
8279
# Check the line above it
8380
if i > 0:

0 commit comments

Comments
 (0)