Skip to content

mypy misses return type errors due to ignore_missing_imports #816

@LacombeLouis

Description

@LacombeLouis

Describe the bug
In residuals.py, _fit_residual_estimator has a return type of Tuple[NDArray, NDArray] but actually returns a RegressorMixin.

This isn't caught by mypy because ignore_missing_imports = True causes sklearn's RegressorMixin to be treated as Any, which is compatible with any return type.

Suggested fix
Add warn_return_any = True to mypy.ini to catch cases where Any is returned from typed functions.

To Reproduce
Steps to reproduce the behavior:
uv run make type-check

Expected behavior
I expect to have an error being raised when such a typing error is present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BacklogThis has a good chance to be implemented at some point.Contributors welcome 👋🏻Especially relevant issue/PR for contributors to work on.Good first issueEasy issue to start to contribute to MAPIE

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions