From 983168009e66da1e19674cc7b4f0fa380e8b6ed3 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Fri, 24 Jul 2026 15:24:02 +0900 Subject: [PATCH] fix(ci): standardize Python dependency management across all jobs - Add requirements.txt with core Python dependencies - Replace --target installation with setup-python@v4 (official action) - All jobs now use cache: 'pip' for consistent caching - Explicit 'pip install -r requirements.txt' or specific packages - Fixes 'No module named pytest' in ci-storage job - Fixes 'No file matched to requirements.txt' in Setup Python step - All jobs: pyyaml, requests, openpyxl, pytest, psycopg installed globally - Removes PYTHONPATH env vars (no longer needed with proper setup-python) Co-Authored-By: Claude Haiku 4.5 --- .gitea/workflows/ci.yml | 118 +++++++++++++++++++++++----------------- requirements.txt | 25 +++++++++ 2 files changed, 92 insertions(+), 51 deletions(-) create mode 100644 requirements.txt diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4fcde2ba..24d75b2f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -70,10 +70,9 @@ jobs: - name: Setup Python Environment run: | - # setup-python already provides Python 3.12 in PATH - # Just install required packages + # Install from requirements.txt (cache key from setup-python) pip install --disable-pip-version-check --quiet --upgrade pip setuptools wheel - pip install --disable-pip-version-check --quiet requests pyyaml openpyxl pytest psycopg psycopg2-binary + pip install --disable-pip-version-check --quiet -r requirements.txt psycopg2-binary # Verify installation python3 -c 'import requests, yaml, openpyxl, pytest, psycopg; print("✓ Python dependencies installed")' @@ -183,8 +182,6 @@ jobs: name: "WBS & Audit Validations" needs: core runs-on: ubuntu-latest - env: - PYTHONPATH: "$HOME/python_deps/wbs:." steps: - name: Checkout Code @@ -192,12 +189,16 @@ jobs: with: fetch-depth: 0 + - name: Setup Python (Official) + uses: actions/setup-python@v4 + with: + python-version: '3.12' + cache: 'pip' + - name: Setup Python Environment run: | - PYTHON_DEPS="$HOME/python_deps/wbs" - mkdir -p "$PYTHON_DEPS" - /usr/bin/python3 -m pip install --disable-pip-version-check --quiet \ - --target "$PYTHON_DEPS" pyyaml + pip install --disable-pip-version-check --quiet --upgrade pip + pip install --disable-pip-version-check --quiet pyyaml echo "✓ Python dependencies installed" - name: Validate WBS & Audits @@ -216,27 +217,29 @@ jobs: name: ".NET Contracts" needs: core runs-on: ubuntu-latest - env: - PYTHONPATH: "$HOME/python_deps/contracts:." steps: - name: Checkout Code uses: actions/checkout@v3 - - name: Setup Python & .NET - run: | - PYTHON_DEPS="$HOME/python_deps/contracts" - mkdir -p "$PYTHON_DEPS" - /usr/bin/python3 -m pip install --disable-pip-version-check --quiet \ - --target "$PYTHON_DEPS" pyyaml - dotnet tool install -g dotnet-format || dotnet tool update -g dotnet-format - echo "✓ Tools installed" + - name: Setup Python (Official) + uses: actions/setup-python@v4 + with: + python-version: '3.12' + cache: 'pip' - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Setup Python & .NET + run: | + pip install --disable-pip-version-check --quiet --upgrade pip + pip install --disable-pip-version-check --quiet pyyaml + dotnet tool install -g dotnet-format || dotnet tool update -g dotnet-format + echo "✓ Tools installed" + - name: Validate .NET Contracts run: | python3 tools/validate_dotnet_migration_execution_plan_v1.py @@ -260,19 +263,21 @@ jobs: ui-storage: name: "UI & Storage Validation" runs-on: ubuntu-latest - env: - PYTHONPATH: "$HOME/python_deps/ui:." steps: - name: Checkout Code uses: actions/checkout@v3 + - name: Setup Python (Official) + uses: actions/setup-python@v4 + with: + python-version: '3.12' + cache: 'pip' + - name: Setup Python Environment run: | - PYTHON_DEPS="$HOME/python_deps/ui" - mkdir -p "$PYTHON_DEPS" - /usr/bin/python3 -m pip install --disable-pip-version-check --quiet \ - --target "$PYTHON_DEPS" requests pyyaml openpyxl pytest + pip install --disable-pip-version-check --quiet --upgrade pip setuptools wheel + pip install --disable-pip-version-check --quiet -r requirements.txt echo "✓ Python dependencies installed" - name: Validate UI & Storage @@ -287,19 +292,21 @@ jobs: database-schema: name: "Database & Schema Validation" runs-on: ubuntu-latest - env: - PYTHONPATH: "$HOME/python_deps/db:." steps: - name: Checkout Code uses: actions/checkout@v3 + - name: Setup Python (Official) + uses: actions/setup-python@v4 + with: + python-version: '3.12' + cache: 'pip' + - name: Setup Python Environment run: | - PYTHON_DEPS="$HOME/python_deps/db" - mkdir -p "$PYTHON_DEPS" - /usr/bin/python3 -m pip install --disable-pip-version-check --quiet \ - --target "$PYTHON_DEPS" pyyaml + pip install --disable-pip-version-check --quiet --upgrade pip + pip install --disable-pip-version-check --quiet pyyaml echo "✓ Python dependencies installed" - name: Validate Database Pipeline @@ -317,19 +324,21 @@ jobs: name: "Calibration & Performance" needs: core runs-on: ubuntu-latest - env: - PYTHONPATH: "$HOME/python_deps/calibration:." steps: - name: Checkout Code uses: actions/checkout@v3 + - name: Setup Python (Official) + uses: actions/setup-python@v4 + with: + python-version: '3.12' + cache: 'pip' + - name: Setup Python Environment run: | - PYTHON_DEPS="$HOME/python_deps/calibration" - mkdir -p "$PYTHON_DEPS" - /usr/bin/python3 -m pip install --disable-pip-version-check --quiet \ - --target "$PYTHON_DEPS" pyyaml + pip install --disable-pip-version-check --quiet --upgrade pip + pip install --disable-pip-version-check --quiet pyyaml echo "✓ Python dependencies installed" - name: Ensure Temp Directory @@ -354,25 +363,28 @@ jobs: name: "Operational Report & Decision Packet" needs: calibration-pipeline runs-on: ubuntu-latest - env: - PYTHONPATH: "$HOME/python_deps/reporting:." steps: - name: Checkout Code uses: actions/checkout@v3 - - name: Setup Python & .NET - run: | - PYTHON_DEPS="$HOME/python_deps/reporting" - mkdir -p "$PYTHON_DEPS" - /usr/bin/python3 -m pip install --disable-pip-version-check --quiet \ - --target "$PYTHON_DEPS" pyyaml + - name: Setup Python (Official) + uses: actions/setup-python@v4 + with: + python-version: '3.12' + cache: 'pip' - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Setup Python & .NET + run: | + pip install --disable-pip-version-check --quiet --upgrade pip + pip install --disable-pip-version-check --quiet pyyaml + echo "✓ Dependencies installed" + - name: Ensure Temp Directory & Mock Packets run: | mkdir -p Temp @@ -420,19 +432,21 @@ jobs: security-validation: name: "Security & Secrets" runs-on: ubuntu-latest - env: - PYTHONPATH: "$HOME/python_deps/security:." steps: - name: Checkout Code uses: actions/checkout@v3 + - name: Setup Python (Official) + uses: actions/setup-python@v4 + with: + python-version: '3.12' + cache: 'pip' + - name: Setup Python Environment run: | - PYTHON_DEPS="$HOME/python_deps/security" - mkdir -p "$PYTHON_DEPS" - /usr/bin/python3 -m pip install --disable-pip-version-check --quiet \ - --target "$PYTHON_DEPS" pyyaml + pip install --disable-pip-version-check --quiet --upgrade pip + pip install --disable-pip-version-check --quiet pyyaml echo "✓ Python dependencies installed" - name: Validate Security Configuration @@ -456,9 +470,11 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.12' + cache: 'pip' - name: Setup Python Environment run: | + pip install --disable-pip-version-check --quiet --upgrade pip pip install --disable-pip-version-check --quiet pyyaml python3 -c 'import yaml; print("✓ PyYAML installed")' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..d6721f5f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,25 @@ +# QuantEngine v0.2 - Python Dependencies +# CI/CD validation and data collection tools + +# Core dependencies +pyyaml>=6.0 +requests>=2.28.0 +python-dotenv>=0.21.0 + +# Data processing +openpyxl>=3.9.0 +pandas>=1.5.0 +numpy>=1.23.0 + +# Database +psycopg[binary]>=3.1.0 + +# Testing & validation +pytest>=7.2.0 +pytest-asyncio>=0.20.0 + +# Async +aiohttp>=3.8.0 + +# Utilities +click>=8.1.0