Summary
The codebase currently uses lenient mypy settings. Analysis shows we can progressively enable stricter type checking.
Current Settings (Lenient)
disallow_untyped_calls = false
disallow_untyped_defs = false
disallow_untyped_decorators = false
check_untyped_defs = false
ignore_missing_imports = true
allow_redefinition = true
Analysis Results
| Setting |
Source Errors |
Test Errors |
Effort |
disallow_untyped_calls=true |
0 |
0 |
Free ✅ |
disallow_untyped_decorators=true |
0 |
0 |
Free ✅ |
ignore_missing_imports=false |
0 |
0 |
Free ✅ |
disallow_untyped_defs=true |
7 |
71 |
Low (source) / High (tests) |
check_untyped_defs=true |
0 |
4 |
Low |
Full --strict |
17 |
92 |
Medium / High |
Phases
Phase 1: Free Wins ✅ (Done in PR #39)
disallow_untyped_calls = true
disallow_untyped_decorators = true
ignore_missing_imports = false
Phase 2: Source Code Typing (Medium Effort, ~17 fixes)
Files affected:
handler/rewriter/__init__.py - 10 errors (7 type-arg, 3 no-untyped-def)
mixin.py - 4 errors (1 type-arg, 3 no-untyped-def)
handler/sqlalchemy_easy_softdelete.py - 1 error (no-untyped-def)
hook.py - 1 error (no-untyped-def)
Work needed:
- Add return type
-> bool to hook.py:match_name
- Add type hints to
mixin.py nested functions
- Add return type to
soft_delete_execute function
- Add type parameters to generic types (
Select[Any], CompoundSelect[Any], etc.)
Phase 3: Test Typing (High Effort, Optional)
Use per-module config to exempt tests from strict checking:
[mypy-tests.*]
disallow_untyped_defs = false
Or fix all 71 test functions to have -> None return types.
Commands to Test
# Current baseline
uv run mypy sqlalchemy_easy_softdelete tests/
# Test strict mode on source only
uv run mypy --strict sqlalchemy_easy_softdelete/
# Test individual settings
uv run mypy --disallow-untyped-defs sqlalchemy_easy_softdelete tests/
uv run mypy --check-untyped-defs sqlalchemy_easy_softdelete tests/
Summary
The codebase currently uses lenient mypy settings. Analysis shows we can progressively enable stricter type checking.
Current Settings (Lenient)
Analysis Results
disallow_untyped_calls=truedisallow_untyped_decorators=trueignore_missing_imports=falsedisallow_untyped_defs=truecheck_untyped_defs=true--strictPhases
Phase 1: Free Wins ✅ (Done in PR #39)
disallow_untyped_calls = truedisallow_untyped_decorators = trueignore_missing_imports = falsePhase 2: Source Code Typing (Medium Effort, ~17 fixes)
Files affected:
handler/rewriter/__init__.py- 10 errors (7 type-arg, 3 no-untyped-def)mixin.py- 4 errors (1 type-arg, 3 no-untyped-def)handler/sqlalchemy_easy_softdelete.py- 1 error (no-untyped-def)hook.py- 1 error (no-untyped-def)Work needed:
-> booltohook.py:match_namemixin.pynested functionssoft_delete_executefunctionSelect[Any],CompoundSelect[Any], etc.)Phase 3: Test Typing (High Effort, Optional)
Use per-module config to exempt tests from strict checking:
Or fix all 71 test functions to have
-> Nonereturn types.Commands to Test