From e22990cf6ddddaf2ffe510606b47c8b5c45e80a9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 May 2025 09:40:16 -0600 Subject: [PATCH 01/15] Add VSCode extension sync check to CI and pre-commit --- .github/workflows/ci.yaml | 35 ++++++++++++++++++++-- .pre-commit-config.yaml | 17 +++++++++-- scripts/check_extension_sync.py | 52 +++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 scripts/check_extension_sync.py diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fca78144..5d3a5f45 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,6 @@ name: CI/CD - +permissions: + contents: write on: push: branches: [main] @@ -16,7 +17,8 @@ jobs: steps: - uses: actions/checkout@v4 - + with: + fetch-depth: 0 - name: Install uv uses: astral-sh/setup-uv@v5 @@ -64,6 +66,35 @@ jobs: # Upload coverage (if tests are being run) # - name: Upload coverage # uses: codecov/codecov-action@v4 + license-check: + name: License Compliance Check + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: Cache Go bin path + run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + + - name: Install addlicense + run: go install github.com/google/addlicense@latest + + - name: Run addlicense check (only on relevant files) + run: | + year=$(date +'%Y') + find . -type f \( -name '*.py' -o -name '*.sh' -o -name '*.go' \) \ + -not -path './.git/*' \ + -not -path './.venv/*' \ + -not -path './vendor/*' \ + | xargs $(go env GOPATH)/bin/addlicense -check -c "Steve Morin" -l mit -y "$year" -s -v # Only run security checks on pull requests from the main repository security: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f32ddf81..a18bcf9e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,3 @@ -# .pre-commit-config.yaml repos: - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.8.0 @@ -47,4 +46,18 @@ repos: language: system types: [python] pass_filenames: false # Run full test suite - stages: [pre-commit] # Only run on pre-commit + stages: [pre-commit] # Only run on commit + - repo: local + hooks: + - id: license-check + name: Check license headers + entry: python scripts/check_license.py + language: system + types: [python, shell] + - repo: local + hooks: + - id: check-vscode-extension-sync + name: Check VSCode Extension Sync + entry: uvx scripts/check_extension_sync.py + language: system + types: [json] diff --git a/scripts/check_extension_sync.py b/scripts/check_extension_sync.py new file mode 100644 index 00000000..dbf940bf --- /dev/null +++ b/scripts/check_extension_sync.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import json +import sys +import os +from pathlib import Path + +EXTENSIONS_FILE = Path(".vscode/extensions.json") +DEVCONTAINER_FILE = Path(".devcontainer/devcontainer.json") + +def load_json(file_path): + try: + with open(file_path) as f: + return json.load(f) + except FileNotFoundError: + print(f"❌ Error: {file_path} not found.") + sys.exit(2) + except json.JSONDecodeError as e: + print(f"❌ Error parsing {file_path}: {e}") + sys.exit(2) + +def extract_recommended_extensions(data): + return set(data.get("recommendations", [])) + +def extract_devcontainer_extensions(data): + try: + return set(data["customizations"]["vscode"]["extensions"]) + except KeyError: + return set() + +def main(): + vscode_data = load_json(EXTENSIONS_FILE) + devcontainer_data = load_json(DEVCONTAINER_FILE) + + vscode_exts = extract_recommended_extensions(vscode_data) + dev_exts = extract_devcontainer_extensions(devcontainer_data) + + missing = vscode_exts - dev_exts + + if missing: + print("❌ VSCode extensions not synced with devcontainer configuration!\n") + print("Missing from .devcontainer/devcontainer.json:") + for ext in sorted(missing): + print(f"- {ext}") + print("\nTo fix: Add these extensions to the `customizations.vscode.extensions` array in `.devcontainer/devcontainer.json`") + sys.exit(1) + + print("✅ VSCode extensions are in sync.") + sys.exit(0) + +if __name__ == "__main__": + main() From 88ae92778441d67b362f925f0e6c17e3e2114ec6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 May 2025 09:46:54 -0600 Subject: [PATCH 02/15] Cleaning documents --- .pre-commit-config.yaml | 7 ------- Justfile | 24 ++++++++++++++++++------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a18bcf9e..c0b085f8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,13 +49,6 @@ repos: stages: [pre-commit] # Only run on commit - repo: local hooks: - - id: license-check - name: Check license headers - entry: python scripts/check_license.py - language: system - types: [python, shell] - - repo: local - hooks: - id: check-vscode-extension-sync name: Check VSCode Extension Sync entry: uvx scripts/check_extension_sync.py diff --git a/Justfile b/Justfile index bde43efc..ff59e0ca 100644 --- a/Justfile +++ b/Justfile @@ -299,13 +299,21 @@ debug-info: # Update CONTRIBUTORS.md file [group('build')] @contributors: -update-contributors: echo "Updating CONTRIBUTORS.md..." - # Cross-platform way to update CONTRIBUTORS.md using git shortlog - echo "# Contributors" > CONTRIBUTORS.md - echo "" >> CONTRIBUTORS.md - git shortlog -sne >> CONTRIBUTORS.md - echo "✓ Contributors list updated" + if [ "$$OS" = "Windows_NT" ]; then \ + powershell -File scripts/update_contributors.ps1; \ + else \ + echo "{{YELLOW}}TODO: Add macOS/Linux command to update CONTRIBUTORS.md here{{NC}}"; \ + # Example placeholder: ./scripts/update_contributors.sh + fi + echo "{{CHECK}} Contributors list updated" + +# # Generate changelog from conventional commits +# changelog: +# echo "Generating changelog..." +# command -v cog >/dev/null 2>&1 || { echo "{{RED}}Error: Cocogitto (cog) is not installed{{NC}}"; exit 1; } +# cog changelog --at=HEAD +# echo "{{GREEN}}✓{{NC}} Changelog generated" # Verify commit messages follow conventional commit format [group('pre-commit')] @@ -628,5 +636,9 @@ clean-pr-to-testrepo new_repo_name="test-actions-repo": # just build # just run +# Check if VSCode recommended extensions are synced with devcontainer +check-extension-sync: + uv run scripts/check_extension_sync.py + # Alias for dev (full developer cycle: format → lint → test → build) alias cycle := dev From 5fc76251650279799a13e6bbd641c576e35d1548 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 May 2025 09:57:32 -0600 Subject: [PATCH 03/15] Cleaning documents --- .devcontainer/devcontainer.json | 24 +++++++++++++++++++++ .github/workflows/ci.yaml | 37 +++------------------------------ Justfile | 2 +- 3 files changed, 28 insertions(+), 35 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..0e09551c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "name": "PyLaunch Blueprint", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.black-formatter", + "charliermarsh.ruff", + "matangover.mypy", + "tamasfe.even-better-toml", + "redhat.vscode-yaml", + "eamodio.gitlens", + "streetsidesoftware.code-spell-checker" + ] + } + }, + "postCreateCommand": "bash .devcontainer/setup.sh", + "remoteUser": "vscode" +} \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5d3a5f45..cf9776e7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,5 @@ name: CI/CD -permissions: - contents: write + on: push: branches: [main] @@ -17,8 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Install uv uses: astral-sh/setup-uv@v5 @@ -66,35 +64,6 @@ jobs: # Upload coverage (if tests are being run) # - name: Upload coverage # uses: codecov/codecov-action@v4 - license-check: - name: License Compliance Check - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.21' - - - name: Cache Go bin path - run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - - name: Install addlicense - run: go install github.com/google/addlicense@latest - - - name: Run addlicense check (only on relevant files) - run: | - year=$(date +'%Y') - find . -type f \( -name '*.py' -o -name '*.sh' -o -name '*.go' \) \ - -not -path './.git/*' \ - -not -path './.venv/*' \ - -not -path './vendor/*' \ - | xargs $(go env GOPATH)/bin/addlicense -check -c "Steve Morin" -l mit -y "$year" -s -v # Only run security checks on pull requests from the main repository security: @@ -123,4 +92,4 @@ jobs: # run: | # uv pip install build twine # python -m build - # twine upload dist/* + # twine upload dist/* \ No newline at end of file diff --git a/Justfile b/Justfile index ff59e0ca..dfc41e8d 100644 --- a/Justfile +++ b/Justfile @@ -636,7 +636,7 @@ clean-pr-to-testrepo new_repo_name="test-actions-repo": # just build # just run -# Check if VSCode recommended extensions are synced with devcontainer +# Check if VSCode recommended extensions are synced with devcontainerm check-extension-sync: uv run scripts/check_extension_sync.py From 33bfca28ff0a832b2a6a4e6bbdf0b3aff87194b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 May 2025 10:03:21 -0600 Subject: [PATCH 04/15] Adding improvements --- scripts/check_extension_sync.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/check_extension_sync.py b/scripts/check_extension_sync.py index dbf940bf..3add2238 100644 --- a/scripts/check_extension_sync.py +++ b/scripts/check_extension_sync.py @@ -2,13 +2,14 @@ import json import sys -import os from pathlib import Path +from typing import Dict, Set, Any EXTENSIONS_FILE = Path(".vscode/extensions.json") DEVCONTAINER_FILE = Path(".devcontainer/devcontainer.json") -def load_json(file_path): + +def load_json(file_path: Path) -> Dict[str, Any]: try: with open(file_path) as f: return json.load(f) @@ -19,16 +20,22 @@ def load_json(file_path): print(f"❌ Error parsing {file_path}: {e}") sys.exit(2) -def extract_recommended_extensions(data): + +def extract_recommended_extensions(data: Dict[str, Any]) -> Set[str]: return set(data.get("recommendations", [])) -def extract_devcontainer_extensions(data): + +def extract_devcontainer_extensions(data: Dict[str, Any]) -> Set[str]: try: - return set(data["customizations"]["vscode"]["extensions"]) + return set( + ext if isinstance(ext, str) else ext["id"] + for ext in data["customizations"]["vscode"]["extensions"] + ) except KeyError: return set() -def main(): + +def main() -> None: vscode_data = load_json(EXTENSIONS_FILE) devcontainer_data = load_json(DEVCONTAINER_FILE) @@ -48,5 +55,5 @@ def main(): print("✅ VSCode extensions are in sync.") sys.exit(0) + if __name__ == "__main__": - main() From 654d60c22d71cead0fc60147b550c72dd854abdb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 May 2025 10:07:15 -0600 Subject: [PATCH 05/15] Solving script sintax issue --- scripts/check_extension_sync.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/check_extension_sync.py b/scripts/check_extension_sync.py index 3add2238..e3488b7a 100644 --- a/scripts/check_extension_sync.py +++ b/scripts/check_extension_sync.py @@ -57,3 +57,5 @@ def main() -> None: if __name__ == "__main__": + main() + \ No newline at end of file From fe7a42c40e6029a37bb76ce10bed9a3d17ac1ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Hern=C3=A1ndez?= Date: Thu, 22 May 2025 14:12:58 -0600 Subject: [PATCH 06/15] Update Justfile Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index dfc41e8d..ff59e0ca 100644 --- a/Justfile +++ b/Justfile @@ -636,7 +636,7 @@ clean-pr-to-testrepo new_repo_name="test-actions-repo": # just build # just run -# Check if VSCode recommended extensions are synced with devcontainerm +# Check if VSCode recommended extensions are synced with devcontainer check-extension-sync: uv run scripts/check_extension_sync.py From fa1705d0afcbb8a944404dccd8cbf695e736b8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Hern=C3=A1ndez?= Date: Thu, 22 May 2025 14:13:06 -0600 Subject: [PATCH 07/15] Update scripts/check_extension_sync.py Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- scripts/check_extension_sync.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/check_extension_sync.py b/scripts/check_extension_sync.py index e3488b7a..8b8c9f8b 100644 --- a/scripts/check_extension_sync.py +++ b/scripts/check_extension_sync.py @@ -57,5 +57,4 @@ def main() -> None: if __name__ == "__main__": - main() - \ No newline at end of file + main() \ No newline at end of file From 7ab3d461196c2aa4d308bb654fb72739db999b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Hern=C3=A1ndez?= Date: Wed, 4 Jun 2025 13:23:12 -0600 Subject: [PATCH 08/15] Update Justfile Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index ff59e0ca..d2d96996 100644 --- a/Justfile +++ b/Justfile @@ -638,7 +638,7 @@ clean-pr-to-testrepo new_repo_name="test-actions-repo": # Check if VSCode recommended extensions are synced with devcontainer check-extension-sync: - uv run scripts/check_extension_sync.py + uvx --with-editable . scripts/check_extension_sync.py # Alias for dev (full developer cycle: format → lint → test → build) alias cycle := dev From 467a15415c70f9e5353eea58dca5f5e420b0660b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Hern=C3=A1ndez?= Date: Wed, 4 Jun 2025 13:23:31 -0600 Subject: [PATCH 09/15] Update .github/workflows/ci.yaml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 59f7425a..16717e3a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -93,4 +93,4 @@ jobs: # run: | # uv pip install build twine # python -m build - # twine upload dist/* \ No newline at end of file + # twine upload dist/* From 9275f8910f736f17f5627a67617d582926fb4143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Hern=C3=A1ndez?= Date: Wed, 4 Jun 2025 13:23:50 -0600 Subject: [PATCH 10/15] Update scripts/check_extension_sync.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- scripts/check_extension_sync.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/check_extension_sync.py b/scripts/check_extension_sync.py index 8b8c9f8b..a8d806f3 100644 --- a/scripts/check_extension_sync.py +++ b/scripts/check_extension_sync.py @@ -12,7 +12,7 @@ def load_json(file_path: Path) -> Dict[str, Any]: try: with open(file_path) as f: - return json.load(f) + return json.load(f) # type: ignore except FileNotFoundError: print(f"❌ Error: {file_path} not found.") sys.exit(2) @@ -20,7 +20,6 @@ def load_json(file_path: Path) -> Dict[str, Any]: print(f"❌ Error parsing {file_path}: {e}") sys.exit(2) - def extract_recommended_extensions(data: Dict[str, Any]) -> Set[str]: return set(data.get("recommendations", [])) From 075c6879f6e5418295e7b4bb21bfa9d744c7fd5e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 4 Jun 2025 14:53:38 -0600 Subject: [PATCH 11/15] Update devcontainer and Justfile --- .devcontainer/devcontainer.json | 16 +++++++++++----- Justfile | 22 +++++++--------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0e09551c..34f84a8d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,15 +1,22 @@ { - "name": "PyLaunch Blueprint", + "name": "py-launch-blueprint", "build": { "dockerfile": "Dockerfile", "context": ".." }, + "postCreateCommand": "just --version", + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" + ], + "remoteUser": "root", + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, "customizations": { "vscode": { "extensions": [ "ms-python.python", "ms-python.vscode-pylance", - "ms-python.black-formatter", "charliermarsh.ruff", "matangover.mypy", "tamasfe.even-better-toml", @@ -19,6 +26,5 @@ ] } }, - "postCreateCommand": "bash .devcontainer/setup.sh", - "remoteUser": "vscode" -} \ No newline at end of file + "features": {} +} diff --git a/Justfile b/Justfile index d2d96996..87e0a168 100644 --- a/Justfile +++ b/Justfile @@ -299,21 +299,13 @@ debug-info: # Update CONTRIBUTORS.md file [group('build')] @contributors: +update-contributors: echo "Updating CONTRIBUTORS.md..." - if [ "$$OS" = "Windows_NT" ]; then \ - powershell -File scripts/update_contributors.ps1; \ - else \ - echo "{{YELLOW}}TODO: Add macOS/Linux command to update CONTRIBUTORS.md here{{NC}}"; \ - # Example placeholder: ./scripts/update_contributors.sh - fi - echo "{{CHECK}} Contributors list updated" - -# # Generate changelog from conventional commits -# changelog: -# echo "Generating changelog..." -# command -v cog >/dev/null 2>&1 || { echo "{{RED}}Error: Cocogitto (cog) is not installed{{NC}}"; exit 1; } -# cog changelog --at=HEAD -# echo "{{GREEN}}✓{{NC}} Changelog generated" + # Cross-platform way to update CONTRIBUTORS.md using git shortlog + echo "# Contributors" > CONTRIBUTORS.md + echo "" >> CONTRIBUTORS.md + git shortlog -sne >> CONTRIBUTORS.md + echo "✓ Contributors list updated" # Verify commit messages follow conventional commit format [group('pre-commit')] @@ -638,7 +630,7 @@ clean-pr-to-testrepo new_repo_name="test-actions-repo": # Check if VSCode recommended extensions are synced with devcontainer check-extension-sync: - uvx --with-editable . scripts/check_extension_sync.py + uv run --with-editable . scripts/check_extension_sync.py # Alias for dev (full developer cycle: format → lint → test → build) alias cycle := dev From 125de439825fc38697c50f323c73701eb1011532 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 4 Jun 2025 14:54:47 -0600 Subject: [PATCH 12/15] Update pre-commit hook versions --- .pre-commit-config.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b2ec888..8747ab00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ # .pre-commit-config.yaml repos: - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.16.0 hooks: - id: mypy additional_dependencies: [ @@ -21,7 +21,7 @@ repos: - id: check-toml - id: check-added-large-files - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.11 + rev: v0.11.12 hooks: - id: ruff entry: ruff check --force-exclude --no-cache @@ -49,8 +49,14 @@ repos: types: [python] pass_filenames: false # Run full test suite stages: [pre-commit] # Only run on pre-commit - - + - repo: local + hooks: + - id: check-vscode-extension-sync + name: Check VSCode Extension Sync + entry: uv run --with-editable . scripts/check_extension_sync.py + language: system + types: [json] + # Global Exclusion # If you want to exclude py_launch_blueprint/_version.py from all pre-commit hooks, # you can use a global exclusion at the top level of your configuration: From fb902cb6c7ddbd156772195f42c09c1a0d163a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Hern=C3=A1ndez?= Date: Wed, 4 Jun 2025 15:36:38 -0600 Subject: [PATCH 13/15] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8747ab00..9979a0e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,14 +49,14 @@ repos: types: [python] pass_filenames: false # Run full test suite stages: [pre-commit] # Only run on pre-commit - - repo: local + - repo: local hooks: - - id: check-vscode-extension-sync - name: Check VSCode Extension Sync - entry: uv run --with-editable . scripts/check_extension_sync.py - language: system - types: [json] - + - id: check-vscode-extension-sync + name: Check VSCode Extension Sync + entry: uv run --with-editable . scripts/check_extension_sync.py + language: system + types: [json] + # Global Exclusion # If you want to exclude py_launch_blueprint/_version.py from all pre-commit hooks, # you can use a global exclusion at the top level of your configuration: @@ -68,7 +68,7 @@ repos: # rev: v4.4.0 # hooks: # - id: end-of-file-fixer - +# # Hook-Level Exclusion (Recommended Approach) # For your specific case where the end-of-file-fixer hook is modifying # py_launch_blue/print_version.py, the most targeted solution is to add an exclusion @@ -87,4 +87,4 @@ repos: # # Example of Excluding Entire Directories # - id: end-of-file-fixer -# exclude: '^py_launch_blueprint/' \ No newline at end of file +# exclude: '^py_launch_blueprint/' From d0ab4aa9a5dad64b2ed00d956d076453e102575b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 5 Jun 2025 11:33:14 -0600 Subject: [PATCH 14/15] Remove trailing whitespace from pre-commit config --- .pre-commit-config.yaml | 11 +++++------ scripts/check_extension_sync.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9979a0e9..a81b8447 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,12 +51,11 @@ repos: stages: [pre-commit] # Only run on pre-commit - repo: local hooks: - - id: check-vscode-extension-sync - name: Check VSCode Extension Sync - entry: uv run --with-editable . scripts/check_extension_sync.py - language: system - types: [json] - + - id: check-vscode-extension-sync + name: Check VSCode Extension Sync + entry: uv run --with-editable . scripts/check_extension_sync.py + language: system + types: [json] # Global Exclusion # If you want to exclude py_launch_blueprint/_version.py from all pre-commit hooks, # you can use a global exclusion at the top level of your configuration: diff --git a/scripts/check_extension_sync.py b/scripts/check_extension_sync.py index a8d806f3..2b1857a9 100644 --- a/scripts/check_extension_sync.py +++ b/scripts/check_extension_sync.py @@ -56,4 +56,4 @@ def main() -> None: if __name__ == "__main__": - main() \ No newline at end of file + main() From 08ff1c3c8053c04b4ba16dca3538c46e993ab2a4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 5 Jun 2025 11:34:18 -0600 Subject: [PATCH 15/15] Fix ruff C401, remove Unicode, and ensure formatting for pre-commit --- scripts/check_extension_sync.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/scripts/check_extension_sync.py b/scripts/check_extension_sync.py index 2b1857a9..152d1872 100644 --- a/scripts/check_extension_sync.py +++ b/scripts/check_extension_sync.py @@ -3,33 +3,34 @@ import json import sys from pathlib import Path -from typing import Dict, Set, Any +from typing import Any EXTENSIONS_FILE = Path(".vscode/extensions.json") DEVCONTAINER_FILE = Path(".devcontainer/devcontainer.json") -def load_json(file_path: Path) -> Dict[str, Any]: +def load_json(file_path: Path) -> dict[str, Any]: try: with open(file_path) as f: return json.load(f) # type: ignore except FileNotFoundError: - print(f"❌ Error: {file_path} not found.") + print(f"Error: {file_path} not found.") sys.exit(2) except json.JSONDecodeError as e: - print(f"❌ Error parsing {file_path}: {e}") + print(f"Error parsing {file_path}: {e}") sys.exit(2) -def extract_recommended_extensions(data: Dict[str, Any]) -> Set[str]: + +def extract_recommended_extensions(data: dict[str, Any]) -> set[str]: return set(data.get("recommendations", [])) -def extract_devcontainer_extensions(data: Dict[str, Any]) -> Set[str]: +def extract_devcontainer_extensions(data: dict[str, Any]) -> set[str]: try: - return set( + return { ext if isinstance(ext, str) else ext["id"] for ext in data["customizations"]["vscode"]["extensions"] - ) + } except KeyError: return set() @@ -44,14 +45,18 @@ def main() -> None: missing = vscode_exts - dev_exts if missing: - print("❌ VSCode extensions not synced with devcontainer configuration!\n") + print("VSCode extensions not synced with devcontainer configuration!\n") print("Missing from .devcontainer/devcontainer.json:") for ext in sorted(missing): print(f"- {ext}") - print("\nTo fix: Add these extensions to the `customizations.vscode.extensions` array in `.devcontainer/devcontainer.json`") + print( + "\nTo fix: Add these extensions to the " + "`customizations.vscode.extensions` array in " + "`.devcontainer/devcontainer.json`" + ) sys.exit(1) - print("✅ VSCode extensions are in sync.") + print("VSCode extensions are in sync.") sys.exit(0)