diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index eeb5051..2344910 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -11,6 +11,24 @@ on: workflow_call: jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - uses: astral-sh/setup-uv@v6 + with: + version: "latest" + - name: Install dependencies + run: uv sync --extra dev + - name: Run pre-commit hooks + run: uv run pre-commit run --all-files + env: + # Commit-message hooks check `git log` HEAD — not meaningful in CI + SKIP: conventional-gitmoji,commitizen + build: runs-on: ubuntu-latest @@ -30,12 +48,6 @@ jobs: with: version: "latest" - name: Install dependencies - run: | - uv sync --extra dev --extra deploy - - name: Lint with ruff - run: | - # Run ruff linting with same args as pre-commit, excluding tools/ and tests/ directories - uv run ruff check . --exclude tools/,tests/ - - name: Test with pytest and capture coverage - run: | - uv run pytest --no-cov + run: uv sync --extra dev --extra deploy + - name: Test with pytest + run: uv run pytest --no-cov diff --git a/src/supervaizer/routes.py b/src/supervaizer/routes.py index 9074125..684d27b 100644 --- a/src/supervaizer/routes.py +++ b/src/supervaizer/routes.py @@ -277,9 +277,7 @@ async def update_case_with_answer( answer_payload = request.answer if isinstance(answer_payload, dict): fields = { - k: v - for k, v in answer_payload.items() - if k != "casestep_index" + k: v for k, v in answer_payload.items() if k != "casestep_index" } else: fields = answer_payload @@ -299,9 +297,7 @@ async def update_case_with_answer( params, ) except Exception as hook_exc: - log.error( - f"[human_answer hook] {owning_agent.name}: {hook_exc}" - ) + log.error(f"[human_answer hook] {owning_agent.name}: {hook_exc}") log.info( f"[Case update] Job {job_id}, Case {case_id} - Answer processed successfully" diff --git a/tests/test_routes_case_update.py b/tests/test_routes_case_update.py index 481a91e..a443a56 100644 --- a/tests/test_routes_case_update.py +++ b/tests/test_routes_case_update.py @@ -1,3 +1,9 @@ +# Copyright (c) 2024-2025 Alain Prasquier - Supervaize.com. All rights reserved. +# +# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +# If a copy of the MPL was not distributed with this file, you can obtain one at +# https://mozilla.org/MPL/2.0/. + # Copyright (c) 2024-2025 Alain Prasquier - Supervaize.com. All rights reserved. # # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -344,9 +350,9 @@ def test_human_answer_only_owning_agent_executed( custom={"m1": stub_method}, human_answer=ha, ) - params_setup = ParametersSetup.from_list( - [Parameter(name="p", value="v", is_environment=True)] - ) + params_setup = ParametersSetup.from_list([ + Parameter(name="p", value="v", is_environment=True) + ]) assert params_setup is not None owner = Agent( name="owner-agent",