Background
The CI pipeline currently limits mypy checks to the stable core modules because the Qt UI layer still contains a large number of typing issues.
Current status:
- Tests pass on Python 3.10–3.12
- Qt headless CI works correctly
- Core modules are type-checked
- Full-project mypy currently reports ~116 errors
Affected areas include:
src/ui/editor_panel.py
src/ui/canvas_panel.py
src/ui/main_window.py
src/ui/widgets.py
src/ui/comment_panel.py
src/ui/settings_dialog.py
src/ui/warnings_dialog.py
Main Error Categories
Qt override signatures
Examples:
paintEvent(self, event)
resizeEvent(self, event)
mousePressEvent(self, event)
PyQt6 stubs require signatures like:
QPaintEvent | None
QResizeEvent | None
QMouseEvent | None
Optional Qt return values
Examples:
menuBar()
statusBar()
document()
clipboard()
horizontalHeader()
These are currently treated as always available but typed as optional in PyQt6 stubs.
Painter overload typing
Examples:
QPainter.drawLines(list[QLineF])
PyQt6 expects array-compatible overloads.
Goals
- Eliminate all current mypy errors
- Re-enable full-project mypy checking in CI
- Improve maintainability and IDE support
- Prepare the UI layer for stricter future typing
Requirements
- No functional regressions
- No UX regressions
- Preserve editor responsiveness
- Preserve rendering performance
- Avoid broad
type: ignore usage
- Prefer explicit typing and safe Optional handling
- Keep changes incremental and reviewable
Suggested Migration Order
- Fix override signatures
- Fix Optional Qt object handling
- Fix painter/container overload typing
- Add missing annotations
- Re-enable full
mypy src/ in CI
Acceptance Criteria
mypy src/ passes without errors
- CI fully green on all Python versions
- No runtime regressions
- No unnecessary suppression comments
- Typing quality improved across UI modules
Background
The CI pipeline currently limits mypy checks to the stable core modules because the Qt UI layer still contains a large number of typing issues.
Current status:
Affected areas include:
src/ui/editor_panel.pysrc/ui/canvas_panel.pysrc/ui/main_window.pysrc/ui/widgets.pysrc/ui/comment_panel.pysrc/ui/settings_dialog.pysrc/ui/warnings_dialog.pyMain Error Categories
Qt override signatures
Examples:
paintEvent(self, event)resizeEvent(self, event)mousePressEvent(self, event)PyQt6 stubs require signatures like:
QPaintEvent | NoneQResizeEvent | NoneQMouseEvent | NoneOptional Qt return values
Examples:
menuBar()statusBar()document()clipboard()horizontalHeader()These are currently treated as always available but typed as optional in PyQt6 stubs.
Painter overload typing
Examples:
QPainter.drawLines(list[QLineF])PyQt6 expects array-compatible overloads.
Goals
Requirements
type: ignoreusageSuggested Migration Order
mypy src/in CIAcceptance Criteria
mypy src/passes without errors