Skip to content

ci(lint): add a lint job and fix the two open ruff findings on main - #145

Open
ddaihao2022 wants to merge 1 commit into
LLMSQL:mainfrom
ddaihao2022:fix-103-lint-job
Open

ddaihao2022 wants to merge 1 commit into
LLMSQL:mainfrom
ddaihao2022:fix-103-lint-job

Conversation

@ddaihao2022

Copy link
Copy Markdown
Contributor

Closes #103

What changes

CI only ran pytest, so ruff check llmsql had been failing on main unnoticed. This fixes the two open findings and adds a lint job so it stays fixed.

  • llmsql/_cli/llmsql_cli.py — I001: the two llmsql._cli imports were unsorted, and the class body started one blank line too early.
  • llmsql/inference/inference_api.py — B905: zip(questions, prompts) silently dropped the tail of whichever list was longer. strict=True turns that into an error instead of generating fewer completions than there are questions.
  • llmsql/_cli/inference.py — only ruff format (one parser.add_argument call wrapped).
  • .github/workflows/tests.yml — new lint job: ruff check llmsql and ruff format --check llmsql.
  • .github/workflows/docs.yml — actions/setup-python@v4 → v5.

Notes on the job

  • ruff is pinned to 0.8.4, the revision in .pre-commit-config.yaml, so CI and the pre-commit hook agree.
  • The job runs on 3.10–3.13 (requires-python = ">=3.10"). This matters: the lint rules include UP (pyupgrade), whose findings depend on [tool.ruff] target-version / the interpreter, so a single version would not catch e.g. a UP fix that is only valid on 3.12+.
  • mypy llmsql is deliberately not in the job yet. mypy --ignore-missing-imports --check-untyped-defs reports pre-existing findings across the package that have nothing to do with this change, so enabling it here would turn the new required job red on the first run. I'd rather do that as its own pass (fix the findings, then add the command) — say the word if you want it in this PR instead.

How it was tested

pip install "ruff==0.8.4"
ruff check llmsql                 # before: 2 errors (I001, B905); after: All checks passed!
ruff format --check llmsql        # before: 3 files would be reformatted; after: 22 files already formatted
pytest tests/utils --ignore=tests/utils/test_inference_utils.py   # 88 passed
pytest tests/cli tests/evaluation tests/inference ...             # 96 passed, 5 failed

The 5 failures are pre-existing on this machine and unrelated: ModuleNotFoundError: No module named 'transformers' (5 files under tests/inference that import it cannot even be collected without transformers, which cannot be installed here). tests/cli gives the identical 5 failures with and without this change.

Not run here: the full pdm install --with dev,vllm suite (needs GPU/vLLM).

Checklist

  • Tests pass where they can run here; the remaining failures are pre-existing and reproduced with the change reverted.
  • ruff check llmsql and ruff format --check llmsql pass.
  • CHANGELOG — none in this repo.
  • Docs — no user-facing change.

Closes LLMSQL#103

- llmsql/_cli/llmsql_cli.py: sort the two llmsql._cli imports (I001) and
  separate the class from them with two blank lines
- llmsql/inference/inference_api.py: zip(questions, prompts) silently dropped
  the tail whenever the two lists had different lengths; pass strict=True (B905)
- llmsql/_cli/inference.py: ruff format (the only change is wrapping one
  parser.add_argument call)

- .github/workflows/tests.yml: new lint job running ruff check and
  ruff format --check on 3.10-3.13, pinned to ruff 0.8.4, the revision in
  .pre-commit-config.yaml. The matrix matters because the lint rules include
  UP (pyupgrade), whose findings depend on the target Python version.
- .github/workflows/docs.yml: actions/setup-python v4 -> v5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] Add lint/type-check job — ruff check currently fails on main

1 participant