Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changes here will be overwritten by Copier
_commit: v0.0.57
_commit: v0.0.58
_src_path: gh:LabAutomationAndScreening/copier-python-package-template.git
configure_python_asyncio: false
configure_vcrpy: false
create_docs: true
description: Generating programs for Vialab to control an Integra Assist Plus liquid
handling robot
Expand Down
7 changes: 4 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ghcr.io/devcontainers/features/aws-cli:1.1.2": {
// https://github.com/devcontainers/features/blob/main/src/aws-cli/devcontainer-feature.json
// view latest version https://raw.githubusercontent.com/aws/aws-cli/v2/CHANGELOG.rst
"version": "2.31.11"
"version": "2.32.6",
},
"ghcr.io/devcontainers/features/python:1.7.1": {
// https://github.com/devcontainers/features/blob/main/src/python/devcontainer-feature.json
Expand All @@ -19,9 +19,10 @@
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"-AmazonWebServices.aws-toolkit-vscode", // the AWS CLI feature installs this automatically, but it's causing problems in VS Code
// basic tooling
// "eamodio.gitlens@15.5.1",
"coderabbit.coderabbit-vscode@0.16.0",
"coderabbit.coderabbit-vscode@0.16.1",
"ms-vscode.live-server@0.5.2025051301",
"MS-vsliveshare.vsliveshare@1.0.5905",
"github.copilot@1.388.0",
Expand Down Expand Up @@ -63,5 +64,5 @@
"initializeCommand": "sh .devcontainer/initialize-command.sh",
"onCreateCommand": "sh .devcontainer/on-create-command.sh",
"postStartCommand": "sh .devcontainer/post-start-command.sh"
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): 4a87b24b # spellchecker:disable-line
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): bc0c1020 # spellchecker:disable-line
}
4 changes: 2 additions & 2 deletions .devcontainer/install-ci-tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import tempfile
from pathlib import Path

UV_VERSION = "0.9.11"
PNPM_VERSION = "10.23.0"
UV_VERSION = "0.9.17"
PNPM_VERSION = "10.25.0"
COPIER_VERSION = "9.11.0"
COPIER_TEMPLATE_EXTENSIONS_VERSION = "0.3.3"
PRE_COMMIT_VERSION = "4.5.0"
Expand Down
44 changes: 18 additions & 26 deletions .devcontainer/windows-host-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,30 @@ repoName=$(basename "$gitUrl" .git)

echo "Repo name extracted as '$repoName'"

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

Comment on lines +30 to 34
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .devcontainer/windows-host-helper.sh

Repository: LabAutomationAndScreening/pyalab

Length of output: 2451


🏁 Script executed:

find .devcontainer -name "*.json" -o -name "*.yaml" -o -name "*.yml" | head -20

Repository: LabAutomationAndScreening/pyalab

Length of output: 164


🏁 Script executed:

if [ -f .devcontainer/devcontainer.json ]; then cat .devcontainer/devcontainer.json; fi

Repository: LabAutomationAndScreening/pyalab

Length of output: 3107


🏁 Script executed:

cat .devcontainer/docker-compose.yml

Repository: LabAutomationAndScreening/pyalab

Length of output: 769


🏁 Script executed:

find . -maxdepth 2 -name "package.json" -o -name "requirements.txt" | head -10

Repository: LabAutomationAndScreening/pyalab

Length of output: 99


🏁 Script executed:

git ls-files | grep -E "(package\.json|requirements\.txt|pnpm|venv)" | head -20

Repository: LabAutomationAndScreening/pyalab

Length of output: 97


Remove rm -rf "./$repoName" or replace with selective cleanup—rsync --exclude does not preserve deleted content

The script deletes the entire repository directory on the Windows host (lines 30–31), then claims to preserve .venv by excluding it from the rsync (lines 46–50, 55–56). This is misleading: if .venv exists on the host filesystem as a directory, rm -rf destroys it, and rsync --exclude cannot restore it—exclusion only prevents overwriting, it does not recover deleted content.

In the current setup, .venv is managed as a Docker named volume (python_venv), so the practical risk is low. However, the script logic is flawed. If node_modules, .pnpm-store, or .venv were ever present on the host filesystem, they would be lost.

To genuinely preserve these directories, either:

  • Remove the rm -rf "./$repoName" and rm -rf "./$repoName/*.md" lines entirely, letting rsync overwrite only necessary files.
  • Or use rsync --delete with appropriate --exclude patterns to selectively clean tracked files while preserving excluded directories.

Also, the excludes for node_modules and .pnpm-store are defensive: this project does not use them (only .venv via Python). Clarify the exclusion list to match actual project dependencies.

Also applies to: 46–50, 55–56

🤖 Prompt for AI Agents
.devcontainer/windows-host-helper.sh around lines 30–34 (and related rsync
excludes at 46–50 and 55–56): the script currently force-deletes the whole repo
directory with sudo rm -rf "./$repoName" and ./ $repoName/*.md which can
irreversibly remove host-side directories like .venv/node_modules/.pnpm-store
that rsync --exclude cannot restore; either remove those rm -rf lines entirely
so rsync can update files in-place, or replace them with a selective rsync-based
cleanup (use rsync --delete together with explicit --exclude patterns) to remove
only tracked files while preserving excluded dirs; also tighten the exclude list
to only the actual host dirs we intend to preserve (e.g., .venv) and remove
unused excludes for node_modules/.pnpm-store if the project doesn't use them;
apply the same change to the other exclude sections referenced (lines 46–50 and
55–56).

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

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


SRC="$(realpath "$tmpdir/$repoName")"
DST="$(realpath "./$repoName")"

# 1) Recreate directory tree under $DST
while IFS= read -r -d '' dir; do
rel="${dir#$SRC/}" # strip leading $SRC/ → e.g. "sub/dir"
mkdir -p "$DST/$rel"
done < <(find "$SRC" -type d -print0)

# 2) Move all files into that mirror
while IFS= read -r -d '' file; do
rel="${file#$SRC/}" # e.g. "sub/dir/file.txt"
# ensure parent exists (though step 1 already did)
mkdir -p "$(dirname "$DST/$rel")"
mv "$file" "$DST/$rel"
done < <(find "$SRC" -type f -print0)

# 3) Clean up now‑empty dirs and the tmp clone
find "$SRC" -depth -type d -empty -delete
# Use rsync to merge all contents (including hidden files) from cloned repo to target
# -a: archive mode (preserves permissions, timestamps, etc.)
# -v: verbose
# --exclude: skip volume mount directories that should not be overwritten
echo "Syncing repository contents..."
rsync -av \
--exclude='node_modules' \
--exclude='.pnpm-store' \
--exclude='.venv' \
"$tmpdir/$repoName/" "./$repoName/"

# Clean up: remove the temporary directory
rm -rf "$tmpdir"

echo "Repository '$repoName' has been synced into '$DST'."
echo "Repository '$repoName' has been updated."
echo "Note: Volume mounts (node_modules, .pnpm-store, .venv) were preserved."
6 changes: 3 additions & 3 deletions .github/actions/install_deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ runs:

- name: Setup python
if: ${{ inputs.python-version != 'notUsing' }}
uses: actions/setup-python@v6.0.0
uses: actions/setup-python@v6.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Setup node
if: ${{ inputs.node-version != 'notUsing' }}
uses: actions/setup-node@v6.0.0
uses: actions/setup-node@v6.1.0
with:
node-version: ${{ inputs.node-version }}

Expand All @@ -75,7 +75,7 @@ runs:

- name: OIDC Auth for CodeArtifact
if: ${{ inputs.code-artifact-auth-role-name != 'no-code-artifact' }}
uses: aws-actions/configure-aws-credentials@v5.1.0
uses: aws-actions/configure-aws-credentials@v5.1.1
with:
role-to-assume: arn:aws:iam::${{ inputs.code-artifact-auth-role-account-id }}:role/${{ inputs.code-artifact-auth-role-name }}
aws-region: ${{ inputs.code-artifact-auth-region }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/update-devcontainer-hash/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
shell: bash

- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
with:
persist-credentials: true
fetch-depth: 1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
UV_PYTHON: ${{ matrix.python-version }}
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- name: Install python tooling
uses: ./.github/actions/install_deps
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- name: Install python tooling
uses: ./.github/actions/install_deps
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/get-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
dependabot-commit-created:
description: whether or not a commit was created on a dependabot branch
value: ${{ jobs.get-values.outputs.dependabot-commit-created }}
pr-short-num:
description: the last two digits of the PR number (to be used for fixed width naming, like Pulumi stacks)
value: ${{ jobs.get-values.outputs.pr-short-num }}

env:
PYTHONUNBUFFERED: True
Expand All @@ -32,7 +35,7 @@ jobs:
JSON

- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
with:
persist-credentials: false

Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/hash_git_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,16 @@ def compute_adler32(repo_path: Path, files: list[str]) -> int:
if not chunk:
break
checksum = zlib.adler32(chunk, checksum)
except Exception as e:
if "[Errno 21] Is a directory" in str(e):
# Ignore symlinks that on windows sometimes get confused as being directories
continue
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
raise
except IsADirectoryError:
# Ignore symlinks that on windows sometimes get confused as being directories
continue

return checksum


def find_devcontainer_hash_line(lines: list[str]) -> tuple[int, str | None]:
"""Find the line index and current hash in the devcontainer.json file."""
for i in range(len(lines) - 1, -1, -1):
for i in reversed(range(len(lines))):
if lines[i].strip() == "}":
# Check the line above it
if i > 0:
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ jobs:
steps:
- name: Checkout code during push
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
with:
ref: ${{ github.ref_name }} # explicitly get the head of the branch, which will include any new commits pushed if this is a dependabot branch
persist-credentials: false

- name: Checkout code not during push
if: ${{ github.event_name != 'push' }}
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
with:
persist-credentials: false

Expand All @@ -59,7 +59,7 @@ jobs:
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

- name: Cache Pre-commit hooks
uses: actions/cache@v4.2.4
uses: actions/cache@v4.3.0
env:
cache-name: cache-pre-commit-hooks
with:
Expand All @@ -69,4 +69,11 @@ jobs:
ubuntu-24.04-py${{ inputs.python-version }}-node-${{ inputs.node-version}}-${{ env.cache-name }}-

- name: Run pre-commit
run: pre-commit run -a
run: |
pre-commit run -a || PRE_COMMIT_EXIT_CODE=$?
if [ -n "$PRE_COMMIT_EXIT_CODE" ]; then
echo "Pre-commit failed with exit code $PRE_COMMIT_EXIT_CODE"
echo "Showing git diff:"
git --no-pager diff
exit $PRE_COMMIT_EXIT_CODE
fi
Comment on lines +72 to +79
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Address shell linting warning in pre-commit step.

The refactoring improves error diagnostics by capturing the pre-commit exit code and displaying git diff on failure. However, static analysis flagged an SC2086 warning (double-quote to prevent globbing/word splitting). Additionally, the exit code capture pattern using || PRE_COMMIT_EXIT_CODE=$? is less idiomatic than using conditional execution.

Consider this more straightforward refactor:

      - name: Run pre-commit
-       run: |
-         pre-commit run -a || PRE_COMMIT_EXIT_CODE=$?
-         if [ -n "$PRE_COMMIT_EXIT_CODE" ]; then
-           echo "Pre-commit failed with exit code $PRE_COMMIT_EXIT_CODE"
-           echo "Showing git diff:"
-           git --no-pager diff
-           exit $PRE_COMMIT_EXIT_CODE
-         fi
+       run: |
+         set -e
+         pre-commit run -a || {
+           EXIT_CODE=$?
+           echo "Pre-commit failed with exit code $EXIT_CODE"
+           echo "Showing git diff:"
+           git --no-pager diff
+           exit "$EXIT_CODE"
+         }

Alternatively, if you prefer the current structure, ensure the exit code variable is consistently quoted: exit "$PRE_COMMIT_EXIT_CODE".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: |
pre-commit run -a || PRE_COMMIT_EXIT_CODE=$?
if [ -n "$PRE_COMMIT_EXIT_CODE" ]; then
echo "Pre-commit failed with exit code $PRE_COMMIT_EXIT_CODE"
echo "Showing git diff:"
git --no-pager diff
exit $PRE_COMMIT_EXIT_CODE
fi
run: |
set -e
pre-commit run -a || {
EXIT_CODE=$?
echo "Pre-commit failed with exit code $EXIT_CODE"
echo "Showing git diff:"
git --no-pager diff
exit "$EXIT_CODE"
}
🧰 Tools
🪛 actionlint (1.7.9)

72-72: shellcheck reported issue in this script: SC2086:info:6:8: Double quote to prevent globbing and word splitting

(shellcheck)

🤖 Prompt for AI Agents
.github/workflows/pre-commit.yaml lines 72-79: the shell snippet that captures
and exits with the pre-commit exit code triggers shellcheck SC2086 due to
unquoted variable usage and uses a less idiomatic capture pattern; update the
script to either use a simple conditional that captures the exit code into a
quoted variable (e.g., run pre-commit and on failure set
PRE_COMMIT_EXIT_CODE="$?" then exit "$PRE_COMMIT_EXIT_CODE") or refactor to use
conditional execution (if pre-commit run -a; then :; else
PRE_COMMIT_EXIT_CODE="$?"; echo "Pre-commit failed with exit code
$PRE_COMMIT_EXIT_CODE"; echo "Showing git diff:"; git --no-pager diff; exit
"$PRE_COMMIT_EXIT_CODE"; fi), ensuring PRE_COMMIT_EXIT_CODE is always quoted
when referenced.

20 changes: 10 additions & 10 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
package-version: ${{ steps.extract-package-version.outputs.package_version }}
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
- name: Setup python
uses: actions/setup-python@v6.0.0
uses: actions/setup-python@v6.1.0
with:
python-version: 3.12.7
- name: Extract package version
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- name: Install python tooling
uses: ./.github/actions/install_deps
Expand All @@ -88,7 +88,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- name: Install python tooling
uses: ./.github/actions/install_deps
Expand Down Expand Up @@ -161,9 +161,9 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
- name: Setup python
uses: actions/setup-python@v6.0.0
uses: actions/setup-python@v6.1.0
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -234,9 +234,9 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
- name: Setup python
uses: actions/setup-python@v6.0.0
uses: actions/setup-python@v6.1.0
with:
python-version: 3.12.7
- name: Confirm tag not already present
Expand Down Expand Up @@ -295,9 +295,9 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1
- name: Setup python
uses: actions/setup-python@v6.0.0
uses: actions/setup-python@v6.1.0
with:
python-version: ${{ matrix.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_to_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- name: Install python tooling
uses: ./.github/actions/install_deps
Expand All @@ -61,7 +61,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- name: Install python tooling
uses: ./.github/actions/install_deps
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ dist
**/logs/*.log.*

# macOS dev cleanliness
*.DS_Store
.DS_Store
**/.DS_Store

# Ignores specific to this repository
Loading