Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defaults:

jobs:
run_checks:
name: Run linting and formatting
name: Run linting, formatting and static type checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ repos:
hooks:
- id: cmake-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.1
hooks:
- id: mypy
# Match all files under duckdb/ or _duckdb-stubs/,
# but not under duckdb/experimental/ or duckdb/query_graph/
files: ^(duckdb/(?!experimental/|query_graph/)|_duckdb-stubs/)
args: ["--config-file", "pyproject.toml"]
language: system
entry: uv run mypy

- repo: local
hooks:
- id: post-checkout-submodules
Expand Down
4 changes: 2 additions & 2 deletions duckdb/polars_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def source_generator(
for record_batch in iter(results.read_next_batch, None):
if predicate is not None and duck_predicate is None:
# We have a predicate, but did not manage to push it down, we fallback here
yield pl.from_arrow(record_batch).filter(predicate) # type: ignore[arg-type,misc]
yield pl.from_arrow(record_batch).filter(predicate) # type: ignore[arg-type,misc,unused-ignore]
else:
yield pl.from_arrow(record_batch) # type: ignore[misc]
yield pl.from_arrow(record_batch) # type: ignore[misc,unused-ignore]

return register_io_source(source_generator, schema=schema)
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,26 @@ filterwarnings = [

[tool.mypy]
packages = ["duckdb", "_duckdb"]
mypy_path = ["_duckdb-stubs"]
strict = true
warn_unreachable = true
pretty = true
python_version = "3.9"
exclude = [
"duckdb/experimental/", # not checking the pyspark API
"duckdb/query_graph/", # old and unmaintained (should probably remove)
"tests",
"scripts",
"sqlogic",
]

[[tool.mypy.overrides]]
module = [
"fsspec.*",
"numpy",
"pandas",
"polars",
"polars.io.plugins",
"pyarrow.*",
"torch",
"tensorflow",
Expand Down
14 changes: 0 additions & 14 deletions tests/stubs/mypy.ini

This file was deleted.

25 changes: 0 additions & 25 deletions tests/stubs/test_stubs.py

This file was deleted.

Loading