From 07fcdef749843ab6de2891e73a730acb671f8860 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 21 Nov 2025 21:07:14 +0000 Subject: [PATCH 1/3] fix(ci): create virtual environment before uv pip install Add 'uv venv' step before 'uv pip install' in both tests and prek-hook jobs to fix "No virtual environment found" error. The uv package manager requires an active virtual environment for pip operations. --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9ad27a0..e55e4b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,6 +30,8 @@ jobs: uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} + - name: Create virtual environment + run: uv venv - name: Install Package run: uv pip install ".[test]" - name: Run pytest @@ -47,6 +49,8 @@ jobs: uses: j178/prek-action@v1 with: install-only: true + - name: Create virtual environment + run: uv venv - name: Install Package run: uv pip install ".[test]" - name: run prek with plugin From 58030a5dfa0d9ac382c40690a00065a7200cd2c7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 21 Nov 2025 21:13:29 +0000 Subject: [PATCH 2/3] fix(ci): activate virtual environment for pytest and prek Add venv activation step that adds .venv/bin (or Scripts on Windows) to GITHUB_PATH. This ensures non-uv tools like pytest and prek use the correct Python interpreter and installed packages from the virtual environment. Without this, pytest and prek would use the system Python and not find the test dependencies installed by uv pip. --- .github/workflows/tests.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e55e4b7..b6a506d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,6 +32,14 @@ jobs: python-version: ${{ matrix.python-version }} - name: Create virtual environment run: uv venv + - name: Activate virtual environment + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + echo "$GITHUB_WORKSPACE/.venv/Scripts" >> $GITHUB_PATH + else + echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH + fi + shell: bash - name: Install Package run: uv pip install ".[test]" - name: Run pytest @@ -51,6 +59,8 @@ jobs: install-only: true - name: Create virtual environment run: uv venv + - name: Activate virtual environment + run: echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH - name: Install Package run: uv pip install ".[test]" - name: run prek with plugin From b4397ec566bf649c72f36ee5ad9cf5aa131ef12e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 21 Nov 2025 21:14:58 +0000 Subject: [PATCH 3/3] fix(ci): use setup-uv activate-environment for venv setup Use the setup-uv action's built-in activate-environment parameter instead of manually creating and activating virtual environments. This simplifies the workflow by eliminating repetitive venv setup code and leveraging the action's cross-platform venv handling. The activate-environment parameter automatically creates a venv and makes it available to subsequent steps, reducing the workflow from multiple manual steps to a single declarative configuration. --- .github/workflows/tests.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b6a506d..bad0446 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,16 +30,7 @@ jobs: uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} - - name: Create virtual environment - run: uv venv - - name: Activate virtual environment - run: | - if [ "$RUNNER_OS" == "Windows" ]; then - echo "$GITHUB_WORKSPACE/.venv/Scripts" >> $GITHUB_PATH - else - echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH - fi - shell: bash + activate-environment: true - name: Install Package run: uv pip install ".[test]" - name: Run pytest @@ -53,14 +44,11 @@ jobs: uses: astral-sh/setup-uv@v7 with: python-version: 3.12 + activate-environment: true - name: Install prek uses: j178/prek-action@v1 with: install-only: true - - name: Create virtual environment - run: uv venv - - name: Activate virtual environment - run: echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH - name: Install Package run: uv pip install ".[test]" - name: run prek with plugin