Summary
The CI runs mypy with strict = true and currently reports 63 errors across 12 source files. These are pre-existing type annotation issues — the Type Check job is set to continue-on-error: true so it doesn't block merging, but we should resolve them.
Error Breakdown by Category
no-any-return (10 errors)
Functions with return type annotations that return numpy/pandas values mypy can't verify.
| File |
Lines |
models/ols.py |
74, 88, 110 |
models/ar.py |
102, 112 |
models/adl.py |
119, 129 |
results/base.py |
143 |
tests/bai_perron.py |
452, 459, 632 |
visualization/params.py |
145 |
Fix: Add explicit casts or adjust return type annotations.
arg-type — numpy dtype mismatches (17 errors)
Numpy signedinteger vs float64 dtype mismatches when appending to typed lists, plus ArrayLike | None vs ArrayLike issues.
| File |
Lines |
models/ar.py |
450, 455, 461, 610 |
models/adl.py |
668, 674, 680, 790, 1032 |
rolling/ar.py |
281, 286, 546, 551 |
rolling/adl.py |
400, 406, 412, 443, 739, 745, 751, 782 |
tests/bai_perron.py |
361 |
visualization/breaks.py |
280 |
Fix: Use broader NDArray[np.floating[Any]] type annotations for lists, or cast arrays.
assignment — Figure type narrowing (6 errors)
ax.get_figure() returns Figure | SubFigure | None, but variables are typed as Figure.
| File |
Lines |
visualization/breaks.py |
132, 254 |
visualization/diagnostics.py |
267, 391 |
visualization/params.py |
568 |
Fix: Use assert isinstance(fig, Figure) or handle the None/SubFigure cases.
unused-ignore (5 errors)
Stale # type: ignore comments that no longer match the actual error codes.
| File |
Lines |
visualization/breaks.py |
132, 254 |
visualization/diagnostics.py |
267, 391, 506 |
Fix: Remove or update the # type: ignore comments with correct error codes.
attr-defined (2 errors)
RegressionResultsBase has no attribute sigma.
| File |
Lines |
visualization/diagnostics.py |
381, 627 |
Fix: Add sigma to RegressionResultsBase or narrow the type to a subclass that has it.
return-value (3 errors)
Incompatible return types (e.g., returning None where ndarray expected, complex vs floating array).
| File |
Lines |
models/ols.py |
495 |
models/ar.py |
78 |
models/adl.py |
95 |
Fix: Adjust return type annotations or add runtime checks.
union-attr (1 error)
Accessing .get_figure() on Axes | Sequence[Axes].
| File |
Line |
visualization/params.py |
568 |
Fix: Narrow the type before calling .get_figure().
call-overload (1 error)
pd.DataFrame constructor type mismatch with dict of ndarrays.
| File |
Line |
results/base.py |
259 |
Fix: Adjust the dict value type or add a cast.
Files Affected
src/regimes/models/ols.py (5 errors)
src/regimes/models/ar.py (6 errors)
src/regimes/models/adl.py (7 errors)
src/regimes/rolling/ar.py (4 errors)
src/regimes/rolling/adl.py (8 errors)
src/regimes/tests/bai_perron.py (6 errors)
src/regimes/results/base.py (3 errors)
src/regimes/visualization/breaks.py (5 errors)
src/regimes/visualization/diagnostics.py (7 errors)
src/regimes/visualization/params.py (3 errors)
Suggested Approach
- Fix
unused-ignore comments first (quick wins, reduces noise)
- Fix
assignment / union-attr with type narrowing (assert isinstance(...))
- Fix
no-any-return with explicit casts
- Fix
arg-type dtype mismatches by broadening list type annotations
- Fix
attr-defined by adding sigma to the base class or narrowing types
- Fix
return-value issues with corrected annotations
CI Context
The Type Check job in CI uses continue-on-error: true so these errors are visible but non-blocking. Once resolved, we can remove continue-on-error to make mypy a hard gate.
Summary
The CI runs mypy with
strict = trueand currently reports 63 errors across 12 source files. These are pre-existing type annotation issues — the Type Check job is set tocontinue-on-error: trueso it doesn't block merging, but we should resolve them.Error Breakdown by Category
no-any-return(10 errors)Functions with return type annotations that return numpy/pandas values mypy can't verify.
models/ols.pymodels/ar.pymodels/adl.pyresults/base.pytests/bai_perron.pyvisualization/params.pyFix: Add explicit casts or adjust return type annotations.
arg-type— numpy dtype mismatches (17 errors)Numpy
signedintegervsfloat64dtype mismatches when appending to typed lists, plusArrayLike | NonevsArrayLikeissues.models/ar.pymodels/adl.pyrolling/ar.pyrolling/adl.pytests/bai_perron.pyvisualization/breaks.pyFix: Use broader
NDArray[np.floating[Any]]type annotations for lists, or cast arrays.assignment— Figure type narrowing (6 errors)ax.get_figure()returnsFigure | SubFigure | None, but variables are typed asFigure.visualization/breaks.pyvisualization/diagnostics.pyvisualization/params.pyFix: Use
assert isinstance(fig, Figure)or handle theNone/SubFigurecases.unused-ignore(5 errors)Stale
# type: ignorecomments that no longer match the actual error codes.visualization/breaks.pyvisualization/diagnostics.pyFix: Remove or update the
# type: ignorecomments with correct error codes.attr-defined(2 errors)RegressionResultsBasehas no attributesigma.visualization/diagnostics.pyFix: Add
sigmatoRegressionResultsBaseor narrow the type to a subclass that has it.return-value(3 errors)Incompatible return types (e.g., returning
Nonewherendarrayexpected, complex vs floating array).models/ols.pymodels/ar.pymodels/adl.pyFix: Adjust return type annotations or add runtime checks.
union-attr(1 error)Accessing
.get_figure()onAxes | Sequence[Axes].visualization/params.pyFix: Narrow the type before calling
.get_figure().call-overload(1 error)pd.DataFrameconstructor type mismatch with dict of ndarrays.results/base.pyFix: Adjust the dict value type or add a cast.
Files Affected
src/regimes/models/ols.py(5 errors)src/regimes/models/ar.py(6 errors)src/regimes/models/adl.py(7 errors)src/regimes/rolling/ar.py(4 errors)src/regimes/rolling/adl.py(8 errors)src/regimes/tests/bai_perron.py(6 errors)src/regimes/results/base.py(3 errors)src/regimes/visualization/breaks.py(5 errors)src/regimes/visualization/diagnostics.py(7 errors)src/regimes/visualization/params.py(3 errors)Suggested Approach
unused-ignorecomments first (quick wins, reduces noise)assignment/union-attrwith type narrowing (assert isinstance(...))no-any-returnwith explicit castsarg-typedtype mismatches by broadening list type annotationsattr-definedby addingsigmato the base class or narrowing typesreturn-valueissues with corrected annotationsCI Context
The Type Check job in CI uses
continue-on-error: trueso these errors are visible but non-blocking. Once resolved, we can removecontinue-on-errorto make mypy a hard gate.