Skip to content

Commit 55e865a

Browse files
authored
add ruff + mypy to CI (#2)
1 parent cb64d2b commit 55e865a

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
typecheck:
8+
name: Type check
9+
runs-on: ubuntu-24.04
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.13"
15+
- uses: pypa/hatch@install
16+
# TODO: remove after we release codex-sdk package (and are no longer installing from github)
17+
- name: setup git url rewrite
18+
run: git config --global url."https://${{ secrets.GH_USERNAME }}:${{ secrets.CLEANLAB_BOT_PAT }}@github.com".insteadOf ssh://[email protected]
19+
- run: hatch run types:check
20+
fmt:
21+
name: Format and lint
22+
runs-on: ubuntu-24.04
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.13"
28+
- uses: pypa/hatch@install
29+
- run: hatch fmt --check

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ path = "src/cleanlab_codex/__about__.py"
4040
[tool.hatch.envs.types]
4141
extra-dependencies = [
4242
"mypy>=1.0.0",
43+
"pytest",
44+
"llama-index-core",
4345
]
4446
[tool.hatch.envs.types.scripts]
4547
check = "mypy --install-types --non-interactive {args:src/cleanlab_codex tests}"

src/cleanlab_codex/utils/llamaindex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ def get_function_schema(name: str, func: Callable[..., Any], tool_properties: di
2727
FieldInfo(default=param_default, description=description),
2828
)
2929

30-
return create_model(name, **fields)
30+
return create_model(name, **fields) # type: ignore

tests/test_codex.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ def mock_client() -> Generator[_Codex, None, None]:
1616

1717

1818
def test_query_read_only(mock_client: _Codex):
19-
mock_client.projects.entries.query.return_value = None
19+
mock_client.projects.entries.query.return_value = None # type: ignore
2020
codex = Codex("")
2121
res = codex.query("What is the capital of France?", read_only=True, project_id=fake_project_id)
22-
mock_client.projects.entries.query.assert_called_once_with(fake_project_id, "What is the capital of France?")
23-
mock_client.projects.entries.add_question.assert_not_called()
22+
mock_client.projects.entries.query.assert_called_once_with( # type: ignore
23+
fake_project_id, "What is the capital of France?"
24+
)
25+
mock_client.projects.entries.add_question.assert_not_called() # type: ignore
2426
assert res == (None, None)

0 commit comments

Comments
 (0)