Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Enable mypy in CI #1101

Merged
merged 19 commits into from
Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
uses: py-actions/py-dependency-install@v2.1.0
with:
path: tests/requirements.txt
- name: Run mypy
run: |
pip install -r tests/requirements-mypy.txt
mypy
- name: Run linter
run: |
make lint
Expand Down
30 changes: 30 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[mypy]
Copy link
Contributor Author

@Dreamsorcerer Dreamsorcerer Aug 8, 2021

Choose a reason for hiding this comment

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

Commented out things are to be enabled in future PRs.

#, docs/examples, tests
files = aioredis
check_untyped_defs = True
follow_imports_for_stubs = True
#disallow_any_decorated = True
#disallow_any_generics = True
#disallow_incomplete_defs = True
disallow_subclassing_any = True
#disallow_untyped_calls = True
disallow_untyped_decorators = True
#disallow_untyped_defs = True
implicit_reexport = False
no_implicit_optional = True
show_error_codes = True
strict_equality = True
warn_incomplete_stub = True
warn_redundant_casts = True
warn_unreachable = True
warn_unused_ignores = True
disallow_any_unimported = True
#warn_return_any = True

[mypy-aioredis.client]
# TODO: Fix
ignore_errors = True

[mypy-aioredis.lock]
# TODO: Remove once locks has been rewritten
ignore_errors = True
1 change: 1 addition & 0 deletions CHANGES/1101.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable Mypy in CI.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spelling:
$(MAKE) -C docs spelling

mypy:
$(MYPY) aioredis --ignore-missing-imports
$(MYPY)

test:
$(PYTEST)
Expand All @@ -38,7 +38,7 @@ init-hooks:
pre-commit install-hooks

lint: init-hooks
pre-commit run --all-files
pre-commit run --all-files --show-diff-on-failure

devel: aioredis.egg-info init-hooks
pip install -U pip
Expand Down
13 changes: 8 additions & 5 deletions aioredis/compat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# flake8: noqa
try:
from typing import Protocol, TypedDict # lgtm [py/unused-import]
except ImportError:
from typing_extensions import Protocol, TypedDict # lgtm [py/unused-import]
import sys

if sys.version_info >= (3, 8):
from typing import Protocol, TypedDict
else:
from typing_extensions import Protocol, TypedDict

__all__ = ("Protocol", "TypedDict")
Loading