Skip to content

Commit 43dc065

Browse files
committed
fix: Update MyPy config for optional dependencies
1 parent c904413 commit 43dc065

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

docs/githooks/pre-push

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,16 @@ while read LOCAL_REF LOCAL_SHA REMOTE_REF REMOTE_SHA; do
144144
if command -v mypy &> /dev/null; then
145145
info "Running MyPy type checking..."
146146

147-
if mypy . 2>/dev/null; then
148-
success "MyPy type checking passed"
147+
# Run mypy on src/ directory only (tests/examples excluded in pyproject.toml)
148+
if [ -d "src" ]; then
149+
if mypy src/ 2>/dev/null; then
150+
success "MyPy type checking passed"
151+
else
152+
error "MyPy type checking failed. Please fix all type errors before pushing."
153+
exit 1
154+
fi
149155
else
150-
error "MyPy type checking failed. Please fix all type errors before pushing."
151-
exit 1
156+
info "No src/ directory found, skipping type checking"
152157
fi
153158
echo ""
154159
else

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ module = [
181181
]
182182
ignore_missing_imports = true
183183

184+
[[tool.mypy.overrides]]
185+
module = [
186+
"flask",
187+
"flask.*",
188+
"starlette.*",
189+
"fastapi",
190+
"fastapi.*",
191+
]
192+
ignore_missing_imports = true
193+
184194
[tool.ruff]
185195
target-version = "py312"
186196
line-length = 100

0 commit comments

Comments
 (0)