diff --git a/.github/workflows/cypress-tests.yml b/.github/workflows/cypress-tests.yml index 243b4db85e..2baf505c1d 100644 --- a/.github/workflows/cypress-tests.yml +++ b/.github/workflows/cypress-tests.yml @@ -9,6 +9,10 @@ on: - stable - 'jc/**' +concurrency: + group: e2e-${{ github.ref }} + cancel-in-progress: true + jobs: cypress-run: runs-on: ubuntu-latest diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 6f12f2189c..0658fe926d 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -93,6 +93,7 @@ jobs: -e POSTGRES_HOST=postgres \ -e POSTGRES_PASSWORD=PdwPNS2mDN73Vfbc \ -e POSTGRES_DB=polis-test \ + -e SKIP_GOLDEN=1 \ delphi \ bash -c " \ set -e; \ diff --git a/.spr.yml b/.spr.yml new file mode 100644 index 0000000000..a2862f74a4 --- /dev/null +++ b/.spr.yml @@ -0,0 +1,14 @@ +githubRepoOwner: compdemocracy +githubRepoName: polis +githubHost: github.com +githubRemote: origin +githubBranch: edge +requireChecks: true +requireApproval: true +defaultReviewers: [] +mergeMethod: squash +mergeQueue: false +prTemplateType: stack +forceFetchTags: false +showPrTitlesInStack: false +branchPushIndividually: false diff --git a/delphi/Dockerfile b/delphi/Dockerfile index 4fe6f4eab9..019f4658d5 100644 --- a/delphi/Dockerfile +++ b/delphi/Dockerfile @@ -7,6 +7,13 @@ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 + ENV UV_SYSTEM_PYTHON=1 + + # Install uv for faster package installation (~2x faster than pip) + # Placed in /opt/uv (not /usr/local/bin) to avoid leaking into the final/prod image + # via the blanket COPY --from=builder /usr/local/bin in Stage 2. + COPY --from=ghcr.io/astral-sh/uv:0.11.2 /uv /opt/uv/uv + ENV PATH="/opt/uv:$PATH" RUN apt-get update && \ apt-get install -y --no-install-recommends \ @@ -28,21 +35,21 @@ COPY pyproject.toml requirements.lock ./ # Install dependencies from lock file (cached layer - reused unless requirements.lock changes) -# BuildKit cache mount keeps pip cache between builds for faster rebuilds +# BuildKit cache mount keeps uv cache between builds for faster rebuilds # If USE_CPU_TORCH is true, we install CPU-specific wheels and filter them out of the lockfile -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=/root/.cache/uv \ if [ "$USE_CPU_TORCH" = "true" ]; then \ echo "USE_CPU_TORCH=true: Installing CPU-only PyTorch..." && \ - pip install --index-url https://download.pytorch.org/whl/cpu \ + uv pip install --index-url https://download.pytorch.org/whl/cpu \ torch==2.8.0 \ torchvision==0.23.0 \ torchaudio==2.8.0 && \ echo "Filtering standard torch packages from requirements.lock..." && \ grep -vE "^(torch|torchvision|torchaudio)==" requirements.lock > requirements.filtered.lock && \ - pip install -r requirements.filtered.lock; \ + uv pip install -r requirements.filtered.lock; \ else \ echo "USE_CPU_TORCH=false: Installing standard dependencies..." && \ - pip install -r requirements.lock; \ + uv pip install -r requirements.lock; \ fi # ===== OPTIMIZATION: Copy source code LAST (busts cache on code changes) ===== @@ -54,8 +61,8 @@ RUN --mount=type=cache,target=/root/.cache/pip \ # Install the project package (without dependencies - they're already installed) # This registers entry points and installs the package in development mode - RUN --mount=type=cache,target=/root/.cache/pip \ - pip install --no-deps . + RUN --mount=type=cache,target=/root/.cache/uv \ + uv pip install --no-deps . RUN echo "--- PyTorch Check (after pyproject.toml installation) ---" && \ pip show torch torchvision torchaudio && \ @@ -132,12 +139,14 @@ RUN apt-get update && \ && apt-get clean && \ rm -rf /var/lib/apt/lists/* -# Copy pyproject.toml to install dev dependencies +# Copy uv from builder for faster package installation +COPY --from=builder /opt/uv/uv /usr/local/bin/uv +ENV UV_SYSTEM_PYTHON=1 COPY pyproject.toml . # Install dev dependencies (pytest, etc.) using caching -RUN --mount=type=cache,target=/root/.cache/pip \ - pip install --no-cache-dir ".[dev]" +RUN --mount=type=cache,target=/root/.cache/uv \ + uv pip install ".[dev]" # Default command for test container (can be overridden) CMD ["tail", "-f", "/dev/null"] diff --git a/delphi/tests/test_regression.py b/delphi/tests/test_regression.py index 743857064f..df4823d50d 100644 --- a/delphi/tests/test_regression.py +++ b/delphi/tests/test_regression.py @@ -13,12 +13,19 @@ pytest tests/test_regression.py --include-local # Include local datasets """ +import os + import pytest import numpy as np from polismath.regression import ConversationRecorder, ConversationComparer from polismath.regression.utils import load_golden_snapshot +_skip_golden = pytest.mark.skipif( + os.environ.get("SKIP_GOLDEN") == "1", + reason="Golden snapshot tests disabled (SKIP_GOLDEN=1)", +) + def _check_golden_exists(dataset_name: str): """ @@ -44,6 +51,7 @@ def _check_golden_exists(dataset_name: str): ) +@_skip_golden @pytest.mark.use_discovered_datasets def test_conversation_regression(dataset_name): """ @@ -91,6 +99,7 @@ def test_conversation_regression(dataset_name): ) +@_skip_golden @pytest.mark.use_discovered_datasets def test_conversation_stages_individually(dataset_name): """