From c823c50fe2dab2091f432b39589884a11f2fe6e8 Mon Sep 17 00:00:00 2001 From: Eli Fine Date: Thu, 20 Mar 2025 15:02:57 +0000 Subject: [PATCH 1/3] copier update --- .copier-answers.yml | 2 +- .pre-commit-config.yaml | 2 +- extensions/context.py | 8 +++++++- template/.devcontainer/devcontainer.json.jinja | 3 +++ template/.pre-commit-config.yaml | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 4f187ace..14d0395a 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.0.14 +_commit: v0.0.14-2-g989d612 _src_path: gh:LabAutomationAndScreening/copier-base-template.git description: Copier template for creating Python libraries and executables python_ci_versions: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 54e0475e..087267c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -191,7 +191,7 @@ repos: - id: ruff-format - repo: https://github.com/pylint-dev/pylint - rev: aaab3ccb541532d2bcdf0410ab93ff4fafc266f5 # frozen: v3.3.5 + rev: 88543500c70e3aa303b6c0861e2a7a006673f6a8 hooks: - id: pylint name: pylint diff --git a/extensions/context.py b/extensions/context.py index 3300d403..38a90103 100644 --- a/extensions/context.py +++ b/extensions/context.py @@ -37,7 +37,10 @@ def hook(self, context: dict[Any, Any]) -> dict[Any, Any]: context["gha_checkout"] = "v4.2.2" context["gha_setup_python"] = "v5.4.0" context["gha_cache"] = "v4.2.2" - context["gha_upload_artifact"] = "v4.6.1" + context["gha_upload_artifact"] = "v4.6.2" + context["gha_download_artifact"] = "v4.2.1" + context["gha_setup_buildx"] = "v3.10.0" + context["gha_docker_build_push"] = "v6.15.0" context["gha_configure_aws_credentials"] = "v4.1.0" context["gha_setup_node"] = "v4.3.0" context["gha_mutex"] = "1ebad517141198e08d47cf72f3c0975316620a65 # v1.0.0-alpha.10" @@ -48,6 +51,9 @@ def hook(self, context: dict[Any, Any]) -> dict[Any, Any]: context["py312_version"] = "3.12.7" context["py313_version"] = "3.13.2" + context["debian_release_name"] = "bookworm" + context["alpine_image_version"] = "3.20" + # Kludge to be able to help symlinked jinja files in the child and grandchild templates context["template_uses_vuejs"] = False context["template_uses_javascript"] = False diff --git a/template/.devcontainer/devcontainer.json.jinja b/template/.devcontainer/devcontainer.json.jinja index 69b3add2..1eb5127a 100644 --- a/template/.devcontainer/devcontainer.json.jinja +++ b/template/.devcontainer/devcontainer.json.jinja @@ -41,6 +41,9 @@ {% endraw %}{% if is_child_of_copier_base_template is not defined and template_uses_vuejs is defined and template_uses_vuejs is sameas(true) %}{% raw %} // VueJS "vue.volar@2.2.8", +{% endraw %}{% endif %}{% raw %}{% endraw %}{% if is_child_of_copier_base_template is not defined and template_uses_javascript is defined and template_uses_javascript is sameas(true) %}{% raw %} + // All javascript + "dbaeumer.vscode-eslint@3.0.13", {% endraw %}{% endif %}{% raw %} // Misc file formats diff --git a/template/.pre-commit-config.yaml b/template/.pre-commit-config.yaml index 54e0475e..087267c7 100644 --- a/template/.pre-commit-config.yaml +++ b/template/.pre-commit-config.yaml @@ -191,7 +191,7 @@ repos: - id: ruff-format - repo: https://github.com/pylint-dev/pylint - rev: aaab3ccb541532d2bcdf0410ab93ff4fafc266f5 # frozen: v3.3.5 + rev: 88543500c70e3aa303b6c0861e2a7a006673f6a8 hooks: - id: pylint name: pylint From d22ec2c50f45be5b1ac217056f339431e30d54c0 Mon Sep 17 00:00:00 2001 From: Eli Fine Date: Thu, 20 Mar 2025 15:16:38 +0000 Subject: [PATCH 2/3] more copier --- .copier-answers.yml | 2 +- .devcontainer/windows-host-helper.sh | 51 ++++++++++++++++++++++++++++ extensions/context.py | 2 +- pyproject.toml | 2 +- uv.lock | 9 ++--- 5 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 .devcontainer/windows-host-helper.sh diff --git a/.copier-answers.yml b/.copier-answers.yml index 14d0395a..17a91ec1 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.0.14-2-g989d612 +_commit: v0.0.15 _src_path: gh:LabAutomationAndScreening/copier-base-template.git description: Copier template for creating Python libraries and executables python_ci_versions: diff --git a/.devcontainer/windows-host-helper.sh b/.devcontainer/windows-host-helper.sh new file mode 100644 index 00000000..7c4c2f27 --- /dev/null +++ b/.devcontainer/windows-host-helper.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# If you are using a Windows host and you initially cloned the repository directly onto your hard drive, you may run into file permission issues when running copier updates. To avoid these, after initially building the devcontainer, run this from the repo root: +# cp .devcontainer/windows-host-helper.sh ../ +# cd .. +# bash windows-host-helper.sh + +# If you're still having issues, make sure in Windows Developer Settings that you enabled Developer Mode, and also that you set your git config to have `core.autocrlf=false` and `core.symlinks=true` globally + +set -e # Exit immediately on error + +if [ -z "$BASH_VERSION" ]; then + echo "Error: This script must be run with bash (e.g., 'bash windows-host-helper.sh')." >&2 + exit 1 +fi + +# Check for the git URL argument +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +gitUrl="$1" + +# Extract repository name (removes .git suffix if present) +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 +mkdir -p "./$repoName" + +# 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. +git clone "$gitUrl" "$tmpdir/$repoName" + +# Enable dotglob so that '*' includes hidden files +shopt -s dotglob + +# Move all contents (including hidden files) from the cloned repo to the target folder +mv "$tmpdir/$repoName"/* "./$repoName/" + +# Clean up: remove the temporary directory +rm -rf "$tmpdir" + +echo "Repository '$repoName' has been updated." diff --git a/extensions/context.py b/extensions/context.py index 38a90103..58d7256e 100644 --- a/extensions/context.py +++ b/extensions/context.py @@ -13,7 +13,7 @@ def hook(self, context: dict[Any, Any]) -> dict[Any, Any]: context["uv_version"] = "0.6.6" context["pnpm_version"] = "10.6.3" context["pre_commit_version"] = "4.1.0" - context["pyright_version"] = "1.1.396" + context["pyright_version"] = "1.1.397" context["pytest_version"] = "8.3.4" context["pytest_randomly_version"] = "3.16.0" context["pytest_cov_version"] = "6.0.0" diff --git a/pyproject.toml b/pyproject.toml index ff66bb35..c8bf920f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ dependencies = [ "pytest>=8.3.4", "pytest-cov>=6.0.0", "pytest-randomly>=3.16.0", - "pyright[nodejs]>=1.1.396", + "pyright[nodejs]>=1.1.397", "copier>=9.5.0", "copier-templates-extensions>=0.3.0" diff --git a/uv.lock b/uv.lock index bb8b5629..c6c514c1 100644 --- a/uv.lock +++ b/uv.lock @@ -1,4 +1,5 @@ version = 1 +revision = 1 requires-python = ">=3.12.7" [[package]] @@ -60,7 +61,7 @@ dependencies = [ requires-dist = [ { name = "copier", specifier = ">=9.5.0" }, { name = "copier-templates-extensions", specifier = ">=0.3.0" }, - { name = "pyright", extras = ["nodejs"], specifier = ">=1.1.396" }, + { name = "pyright", extras = ["nodejs"], specifier = ">=1.1.397" }, { name = "pytest", specifier = ">=8.3.4" }, { name = "pytest-cov", specifier = ">=6.0.0" }, { name = "pytest-randomly", specifier = ">=3.16.0" }, @@ -357,15 +358,15 @@ wheels = [ [[package]] name = "pyright" -version = "1.1.396" +version = "1.1.397" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "nodeenv" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/bd/73/f20cb1dea1bdc1774e7f860fb69dc0718c7d8dea854a345faec845eb086a/pyright-1.1.396.tar.gz", hash = "sha256:142901f5908f5a0895be3d3befcc18bedcdb8cc1798deecaec86ef7233a29b03", size = 3814400 } +sdist = { url = "https://files.pythonhosted.org/packages/92/23/cefa10c9cb198e0858ed0b9233371d62bca880337f628e58f50dfdfb12f0/pyright-1.1.397.tar.gz", hash = "sha256:07530fd65a449e4b0b28dceef14be0d8e0995a7a5b1bb2f3f897c3e548451ce3", size = 3818998 } wheels = [ - { url = "https://files.pythonhosted.org/packages/80/be/ecb7cfb42d242b7ee764b52e6ff4782beeec00e3b943a3ec832b281f9da6/pyright-1.1.396-py3-none-any.whl", hash = "sha256:c635e473095b9138c471abccca22b9fedbe63858e0b40d4fc4b67da041891844", size = 5689355 }, + { url = "https://files.pythonhosted.org/packages/01/b5/98ec41e1e0ad5576ecd42c90ec363560f7b389a441722ea3c7207682dec7/pyright-1.1.397-py3-none-any.whl", hash = "sha256:2e93fba776e714a82b085d68f8345b01f91ba43e1ab9d513e79b70fc85906257", size = 5693631 }, ] [package.optional-dependencies] From b0c273a7e26a4dac824bf583c985a28505c5118c Mon Sep 17 00:00:00 2001 From: Eli Fine Date: Thu, 20 Mar 2025 15:17:12 +0000 Subject: [PATCH 3/3] copier tag --- .copier-answers.yml | 2 +- template/.devcontainer/windows-host-helper.sh | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 template/.devcontainer/windows-host-helper.sh diff --git a/.copier-answers.yml b/.copier-answers.yml index 17a91ec1..d25be093 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.0.15 +_commit: v0.0.16 _src_path: gh:LabAutomationAndScreening/copier-base-template.git description: Copier template for creating Python libraries and executables python_ci_versions: diff --git a/template/.devcontainer/windows-host-helper.sh b/template/.devcontainer/windows-host-helper.sh new file mode 100644 index 00000000..7c4c2f27 --- /dev/null +++ b/template/.devcontainer/windows-host-helper.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# If you are using a Windows host and you initially cloned the repository directly onto your hard drive, you may run into file permission issues when running copier updates. To avoid these, after initially building the devcontainer, run this from the repo root: +# cp .devcontainer/windows-host-helper.sh ../ +# cd .. +# bash windows-host-helper.sh + +# If you're still having issues, make sure in Windows Developer Settings that you enabled Developer Mode, and also that you set your git config to have `core.autocrlf=false` and `core.symlinks=true` globally + +set -e # Exit immediately on error + +if [ -z "$BASH_VERSION" ]; then + echo "Error: This script must be run with bash (e.g., 'bash windows-host-helper.sh')." >&2 + exit 1 +fi + +# Check for the git URL argument +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +gitUrl="$1" + +# Extract repository name (removes .git suffix if present) +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 +mkdir -p "./$repoName" + +# 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. +git clone "$gitUrl" "$tmpdir/$repoName" + +# Enable dotglob so that '*' includes hidden files +shopt -s dotglob + +# Move all contents (including hidden files) from the cloned repo to the target folder +mv "$tmpdir/$repoName"/* "./$repoName/" + +# Clean up: remove the temporary directory +rm -rf "$tmpdir" + +echo "Repository '$repoName' has been updated."