Skip to content

Commit 26bc5c6

Browse files
pre-commit mypy config (#106)
2 parents 4164cff + e821b9c commit 26bc5c6

File tree

6 files changed

+15
-44
lines changed

6 files changed

+15
-44
lines changed

.github/workflows/code_quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ defaults:
1919

2020
jobs:
2121
run_checks:
22-
name: Run linting and formatting
22+
name: Run linting, formatting and static type checker
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v4

.pre-commit-config.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.13.0
4+
rev: v0.13.3
55
hooks:
66
# Run the linter.
77
- id: ruff-check
88
# Run the formatter.
99
- id: ruff-format
1010

1111
- repo: https://github.com/pre-commit/mirrors-clang-format
12-
rev: v18.1.8 # pick the version of clang-format you want
12+
rev: v21.1.2 # pick the version of clang-format you want
1313
hooks:
1414
- id: clang-format
1515
files: \.(c|cpp|cc|h|hpp|cxx|hxx)$
@@ -19,6 +19,15 @@ repos:
1919
hooks:
2020
- id: cmake-format
2121

22+
- repo: https://github.com/pre-commit/mirrors-mypy
23+
rev: v1.18.2
24+
hooks:
25+
- id: mypy
26+
entry: mypy -v
27+
files: ^(duckdb/|_duckdb-stubs/)
28+
exclude: ^duckdb/(experimental|query_graph)/
29+
additional_dependencies: [ numpy, polars ]
30+
2231
- repo: local
2332
hooks:
2433
- id: post-checkout-submodules

duckdb/polars_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ def source_generator(
277277
for record_batch in iter(results.read_next_batch, None):
278278
if predicate is not None and duck_predicate is None:
279279
# We have a predicate, but did not manage to push it down, we fallback here
280-
yield pl.from_arrow(record_batch).filter(predicate) # type: ignore[arg-type,misc]
280+
yield pl.from_arrow(record_batch).filter(predicate) # type: ignore[arg-type,misc,unused-ignore]
281281
else:
282-
yield pl.from_arrow(record_batch) # type: ignore[misc]
282+
yield pl.from_arrow(record_batch) # type: ignore[misc,unused-ignore]
283283

284284
return register_io_source(source_generator, schema=schema)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ python_version = "3.9"
323323
exclude = [
324324
"duckdb/experimental/", # not checking the pyspark API
325325
"duckdb/query_graph/", # old and unmaintained (should probably remove)
326+
"tests", "scripts",
326327
]
327328

328329
[[tool.mypy.overrides]]

tests/stubs/mypy.ini

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/stubs/test_stubs.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)