From abb2438a426bd8c8e688ef3eb2f76300dd5d65a5 Mon Sep 17 00:00:00 2001 From: Endkind Date: Wed, 15 Oct 2025 11:16:55 +0200 Subject: [PATCH 1/3] - maintenance: bump pre-commit tool versions (pre-commit-hooks v6.0.0, black 25.9.0, isort 6.1.0) - maintenance: replace Windows setup.bat with setup.cmd and add setup.ps1 - maintenance: harden setup.sh (set -euo pipefail), improve messages, install order, and run pre-commit install - maintenance: standardize setup flow (.venv creation, activate, upgrade pip, install pre-commit & hooks, install requirements if present) --- .pre-commit-config.yaml | 6 +++--- setup.bat | 18 ------------------ setup.cmd | 20 ++++++++++++++++++++ setup.ps1 | 21 +++++++++++++++++++++ setup.sh | 12 +++++++----- 5 files changed, 51 insertions(+), 26 deletions(-) delete mode 100644 setup.bat create mode 100644 setup.cmd create mode 100644 setup.ps1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ca0429..82a009f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: end-of-file-fixer exclude: (^|/)requirements.*\.txt$ @@ -9,13 +9,13 @@ repos: - id: check-added-large-files - repo: https://github.com/psf/black - rev: 25.1.0 + rev: 25.9.0 hooks: - id: black language_version: python3 - repo: https://github.com/PyCQA/isort - rev: 6.0.1 + rev: 6.1.0 hooks: - id: isort name: isort (python import sort) diff --git a/setup.bat b/setup.bat deleted file mode 100644 index 30c8733..0000000 --- a/setup.bat +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -IF NOT EXIST .venv ( - python -m venv .venv -) - -CALL .venv\Scripts\activate.bat - -pip install --upgrade pip -pip install pre-commit - -IF EXIST requirements.txt ( - pip install -r requirements.txt -) - -pre-commit install - -ECHO Setup complete diff --git a/setup.cmd b/setup.cmd new file mode 100644 index 0000000..7262634 --- /dev/null +++ b/setup.cmd @@ -0,0 +1,20 @@ +@echo off + +IF NOT EXIST .venv ( + echo "Creating Python virtual environment..." + python -m venv .venv +) + +CALL .venv\Scripts\activate.bat +pip install --upgrade pip + +echo "Installing pre-commit and setting up hooks..." +pip install pre-commit +pre-commit install + +IF NOT EXIST .venv ( + echo "Installing dependencies from requirements.txt..." + pip install -r requirements.txt +) + +echo "Dependencies installed and pre-commit hooks configured." diff --git a/setup.ps1 b/setup.ps1 new file mode 100644 index 0000000..8dc9a13 --- /dev/null +++ b/setup.ps1 @@ -0,0 +1,21 @@ +$ErrorActionPreference = "Stop" +Set-StrictMode -Version Latest + +if (-not (Test-Path ".venv")) { + Write-Host "Creating Python virtual environment..." -ForegroundColor Yellow + python -m venv .venv +} + +. .\.venv\Scripts\Activate.ps1 +pip install --upgrade pip + +Write-Host "Installing pre-commit and setting up hooks..." -ForegroundColor Yellow +pip install pre-commit +pre-commit install + +if (-not (Test-Path ".venv")) { + Write-Host "Installing dependencies from requirements.txt..." -ForegroundColor Yellow + pip install -r requirements.txt +} + +Write-Host "Dependencies installed and pre-commit hooks configured." -ForegroundColor Green diff --git a/setup.sh b/setup.sh index c0b8bf3..fe1653a 100644 --- a/setup.sh +++ b/setup.sh @@ -1,20 +1,22 @@ #!/bin/bash -set -e +set -euo pipefail if [ ! -d ".venv" ]; then + echo "Creating Python virtual environment..." python3 -m venv .venv fi source .venv/bin/activate - pip install --upgrade pip + +echo "Installing pre-commit and setting up hooks..." pip install pre-commit +pre-commit install if [ -f "requirements.txt" ]; then + echo "Installing dependencies from requirements.txt..." pip install -r requirements.txt fi -pre-commit install - -echo "Setup complete" +echo "Dependencies installed and pre-commit hooks configured." From f5540cb9e31720cf8b5bd17622540a9bce669227 Mon Sep 17 00:00:00 2001 From: Endkind <59154176+Endkind@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:19:48 +0200 Subject: [PATCH 2/3] Update setup.cmd Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- setup.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cmd b/setup.cmd index 7262634..a924b1a 100644 --- a/setup.cmd +++ b/setup.cmd @@ -12,7 +12,7 @@ echo "Installing pre-commit and setting up hooks..." pip install pre-commit pre-commit install -IF NOT EXIST .venv ( +IF EXIST requirements.txt ( echo "Installing dependencies from requirements.txt..." pip install -r requirements.txt ) From eeaf9b06e95ff490509e5c531abdc78ede8cc6b2 Mon Sep 17 00:00:00 2001 From: Endkind <59154176+Endkind@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:19:54 +0200 Subject: [PATCH 3/3] Update setup.ps1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.ps1 b/setup.ps1 index 8dc9a13..84f43a5 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -13,7 +13,7 @@ Write-Host "Installing pre-commit and setting up hooks..." -ForegroundColor Yell pip install pre-commit pre-commit install -if (-not (Test-Path ".venv")) { +if (Test-Path "requirements.txt") { Write-Host "Installing dependencies from requirements.txt..." -ForegroundColor Yellow pip install -r requirements.txt }