diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e2d3d9c..3f4756a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c48216c..d3721e1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,6 +6,35 @@ on: pull_request: jobs: + lint: + # `pre-commit run --all-files` is not enforced anywhere, so `ruff check llmsql` + # has been failing on main. Run the same ruff version as .pre-commit-config.yaml + # (v0.8.4) on every supported interpreter: the lint rules include `UP` + # (pyupgrade), whose findings depend on the target Python version. + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install ruff + run: pip install "ruff==0.8.4" + + - name: Lint + run: ruff check llmsql + + - name: Check formatting + run: ruff format --check llmsql + test: runs-on: ubuntu-latest diff --git a/llmsql/_cli/inference.py b/llmsql/_cli/inference.py index 919ced4..46a40aa 100644 --- a/llmsql/_cli/inference.py +++ b/llmsql/_cli/inference.py @@ -176,7 +176,9 @@ def _add_args(self) -> None: # COMMON BENCHMARK ARGS # ========================= def add_common_benchmark_args(parser: argparse.ArgumentParser) -> None: - parser.add_argument("--version", default="2.0", choices=get_available_versions()) + parser.add_argument( + "--version", default="2.0", choices=get_available_versions() + ) parser.add_argument("--output-file", default="llm_sql_predictions.jsonl") parser.add_argument( "--workdir-path", diff --git a/llmsql/_cli/llmsql_cli.py b/llmsql/_cli/llmsql_cli.py index c08e148..5fb54b0 100644 --- a/llmsql/_cli/llmsql_cli.py +++ b/llmsql/_cli/llmsql_cli.py @@ -1,8 +1,9 @@ import argparse import textwrap -from llmsql._cli.inference import Inference from llmsql._cli.evaluate import Evaluate +from llmsql._cli.inference import Inference + class ParserCLI: """Main CLI parser that manages all subcommands.""" diff --git a/llmsql/inference/inference_api.py b/llmsql/inference/inference_api.py index 7746cb7..29d10ba 100644 --- a/llmsql/inference/inference_api.py +++ b/llmsql/inference/inference_api.py @@ -116,7 +116,6 @@ async def _inference_api_async( write_lock = asyncio.Lock() async with aiohttp.ClientSession(headers=headers) as session: - # Pre-build all prompts using the shared function prompts = build_all_requests(questions, tables, prompt_builder) @@ -152,7 +151,9 @@ async def process_question(q: dict[str, Any], prompt: str) -> dict[str, str]: return result - tasks = [process_question(q, p) for q, p in zip(questions, prompts)] + tasks = [ + process_question(q, p) for q, p in zip(questions, prompts, strict=True) + ] for coro in tqdm( asyncio.as_completed(tasks), total=len(tasks),