Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run mypy during CI #391

Merged
merged 5 commits into from
Aug 14, 2022
Merged

Conversation

rnestler
Copy link
Contributor

@rnestler rnestler commented Aug 10, 2022

This runs mypy during CI checks. Note that it doesn't run in strict mode, so doesn't yet provide full type check coverage.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

 * Warn when using non existing mypy options
 * Use Python 3.7
 * Ignore missing imports for dependencies without type definitions
This way we can keep track of the progress in enabling strict type
checking.
# disallow_untyped_calls = true
# disallow_untyped_defs = true
# disallow_incomplete_defs = true
# check_untyped_defs = true
Copy link
Contributor Author

@rnestler rnestler Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably have the highest priority to enable, since it will highlight existing type errors:

src/flask_caching/utils.py:94: error: Argument 1 to "translate" of "str" has incompatible type "*Tuple[Dict[str, None]]"; expected "Union[Mapping[int, Union[int, str, None]], Sequence[Union[int, str, None]]]"
src/flask_caching/utils.py:97: error: Argument 1 to "translate" of "str" has incompatible type "*Tuple[Dict[str, None]]"; expected "Union[Mapping[int, Union[int, str, None]], Sequence[Union[int, str, None]]]"
src/flask_caching/backends/rediscache.py:94: error: "str" not callable
src/flask_caching/backends/rediscache.py:111: error: Incompatible types in assignment (expression has type "List[Any]", variable has type "Tuple[Any, ...]")
src/flask_caching/__init__.py:409: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "cache_timeout"
src/flask_caching/__init__.py:499: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "uncached"
src/flask_caching/__init__.py:500: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "cache_timeout"
src/flask_caching/__init__.py:501: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "make_cache_key"
src/flask_caching/__init__.py:599: error: Argument "timeout" to "_memoize_version" of "Cache" has incompatible type "Union[Any, Callable[..., Any], None]"; expected "Optional[int]"
src/flask_caching/__init__.py:838: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "make_cache_key"
src/flask_caching/__init__.py:885: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "cache_timeout"
src/flask_caching/__init__.py:893: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "uncached"
src/flask_caching/__init__.py:894: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "cache_timeout"
src/flask_caching/__init__.py:895: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "make_cache_key"
src/flask_caching/__init__.py:898: error: Argument "forced_update" to "_memoize_make_cache_key" of "Cache" has incompatible type "Optional[Callable[..., Any]]"; expected "bool"
src/flask_caching/__init__.py:903: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "delete_memoized"
Found 16 errors in 3 files (checked 14 source files)

Copy link
Member

@northernSage northernSage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@northernSage northernSage merged commit 6bb5896 into pallets-eco:master Aug 14, 2022
@rnestler rnestler deleted the run-mypy-in-ci branch August 14, 2022 12:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants