Skip to content

Commit 0fe469b

Browse files
JuliaEdomclaude
andcommitted
ci: type-check app+scripts, add coverage floor, align on Python 3.13
Widens the safety net the audit found gaps in: - mypy now runs over `src app scripts` (was src only). app/'s Streamlit-local imports resolve via mypy_path=[src, app]; frozen scripts/archive/ and the rough wider_sc_poc.py are excluded; six genuine gaps in scripts fixed (list type args, a stale type: ignore, untyped 3rd-party calls annotated). - pytest gains --cov-fail-under=85 so a coverage regression fails CI (currently 91%). - Aligned the declared Python floor on 3.13 (requires-python >=3.13,<3.14) to match ruff/mypy/runtime.txt, which all already target 3.13 — no unverifiable 3.12 leg. - Reformat a test that slipped past the format check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7b4eaa8 commit 0fe469b

7 files changed

Lines changed: 16 additions & 12 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ jobs:
3434
run: uv run ruff format --check src tests scripts app
3535

3636
- name: Mypy strict
37-
run: uv run mypy src
37+
run: uv run mypy src app scripts
3838

3939
- name: Pytest
40-
run: uv run pytest --cov=src/nl_sql --cov-report=term-missing
40+
run: uv run pytest --cov=src/nl_sql --cov-report=term-missing --cov-fail-under=85
4141

4242
repo-hygiene:
4343
runs-on: ubuntu-latest

‎pyproject.toml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "nl-sql"
33
version = "0.1.0"
44
description = "Portfolio demo: NL→SQL assistant with measurable accuracy, schema-RAG, safety guards"
55
readme = "README.md"
6-
requires-python = ">=3.12,<3.14"
6+
requires-python = ">=3.13,<3.14"
77
authors = [{ name = "Julia Edomskikh" }]
88
license = { text = "MIT" }
99

@@ -91,9 +91,14 @@ ignore = [
9191
[tool.mypy]
9292
python_version = "3.13"
9393
strict = true
94-
mypy_path = "src"
94+
# app/ resolves its sibling modules (i18n, theme, components.*) with app/ on the
95+
# path — same as the Streamlit runtime, where app/ is the working dir.
96+
mypy_path = ["src", "app"]
9597
explicit_package_bases = true
9698
disallow_untyped_decorators = false # FastAPI decorators are fine
99+
# Frozen legacy voting scripts (known compare-defect) and a rough proof-of-concept
100+
# are not type-maintained.
101+
exclude = ["scripts/archive/", "scripts/wider_sc_poc.py"]
97102

98103
[[tool.mypy.overrides]]
99104
module = ["tests.*"]
@@ -112,7 +117,7 @@ module = ["diskcache.*"]
112117
ignore_missing_imports = true
113118

114119
[[tool.mypy.overrides]]
115-
module = ["plotly.*", "streamlit", "pandas", "pandas.*"]
120+
module = ["plotly.*", "streamlit", "pandas", "pandas.*", "gdown", "pyarrow.*"]
116121
ignore_missing_imports = true
117122

118123
# Unofficial Perplexity client (github.com/helallao/perplexity-ai): optional

‎scripts/audit_rescore.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import argparse
2020
import json
2121
from pathlib import Path
22+
from typing import Any
2223

2324
from nl_sql.db import DatabaseSpec
2425
from nl_sql.db.connection import execute_readonly, sqlite_url_readonly
@@ -50,7 +51,7 @@ def main() -> int:
5051
engine, r["gold_sql"], statement_timeout_ms=30_000, row_cap=10_000
5152
)
5253
pred_sql = r.get("pred_sql") or ""
53-
pred_rows: list = []
54+
pred_rows: list[Any] = []
5455
pred_failed = False
5556
if pred_sql.strip():
5657
try:

‎scripts/build_fewshot_index.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _load_train_examples(
4141
*,
4242
limit: int | None = None,
4343
) -> list[FewShotExample]:
44-
table = pq.read_table(parquet_path)
44+
table = pq.read_table(parquet_path) # type: ignore[no-untyped-call] # pyarrow stubs mark this untyped
4545
df = table.to_pandas()
4646
if limit:
4747
df = df.head(limit)

‎scripts/download_data.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def download_bird_mini_dev() -> None:
9292

9393
url = f"https://drive.google.com/uc?id={BIRD_MINI_DEV_GDRIVE_ID}"
9494
print(f"[gdown] {url} → {archive}")
95-
gdown.download(url, str(archive), quiet=False)
95+
gdown.download(url, str(archive), quiet=False) # type: ignore[attr-defined] # gdown ships no stubs
9696
else:
9797
print(f"[skip] {archive} already downloaded ({archive.stat().st_size:,} bytes)")
9898
_write_checksum(archive)

‎scripts/merge_hybrid_eval.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pathlib import Path
2222

2323
from nl_sql.eval.report import load_run_from_json, write_html_report, write_json_report
24-
from nl_sql.eval.runner import EvalRecord, EvalRun, _summarise # type: ignore[attr-defined]
24+
from nl_sql.eval.runner import EvalRecord, EvalRun, _summarise
2525

2626

2727
def main(argv: list[str] | None = None) -> int:

‎tests/agent/nodes/test_bird_rescue_hints_flag.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,5 @@ def test_rescue_hints_absent_by_default() -> None:
4747

4848

4949
def test_rescue_hints_present_when_enabled() -> None:
50-
rendered = render_schema_block(
51-
_student_club_expense_context(), enable_bird_rescue_hints=True
52-
)
50+
rendered = render_schema_block(_student_club_expense_context(), enable_bird_rescue_hints=True)
5351
assert "# Schema-link hints" in rendered

0 commit comments

Comments
 (0)