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.cmd similarity index 50% rename from setup.bat rename to setup.cmd index 30c8733..a924b1a 100644 --- a/setup.bat +++ b/setup.cmd @@ -1,18 +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 EXIST requirements.txt ( + echo "Installing dependencies from requirements.txt..." pip install -r requirements.txt ) -pre-commit install - -ECHO Setup complete +echo "Dependencies installed and pre-commit hooks configured." diff --git a/setup.ps1 b/setup.ps1 new file mode 100644 index 0000000..84f43a5 --- /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 (Test-Path "requirements.txt") { + 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."