Skip to content

Commit

Permalink
🧪 Run MyPy against supported Python range
Browse files Browse the repository at this point in the history
This patch moves the MyPy invocation from `Makefile` to the
`pre-commit` tool and introduces a number of runtimes to check.
  • Loading branch information
webknjaz committed Dec 7, 2023
1 parent e8f2827 commit cd4c589
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,50 @@ repos:
^[^/]+[.]rst$
exclude: >-
^CHANGES\.rst$
- repo: https://github.com/pre-commit/mirrors-mypy.git
rev: v1.7.1
hooks:
- id: mypy
alias: mypy-py312
name: MyPy, for Python 3.12
additional_dependencies:
- lxml # requirement of `--txt-report`
args:
- --show-error-codes
- --install-types
- --non-interactive
- --python-version=3.12
- --txt-report=.tox/.tmp/.mypy/python-3.12
- frozenlist/
pass_filenames: false
- id: mypy
alias: mypy-py310
name: MyPy, for Python 3.10
additional_dependencies:
- lxml # requirement of `--txt-report`
args:
- --show-error-codes
- --install-types
- --non-interactive
- --python-version=3.10
- --txt-report=.tox/.tmp/.mypy/python-3.10
- frozenlist/
pass_filenames: false
- id: mypy
alias: mypy-py38
name: MyPy, for Python 3.8
additional_dependencies:
- lxml # requirement of `--txt-report`
args:
- --show-error-codes
- --install-types
- --non-interactive
- --python-version=3.8
- --txt-report=.tox/.tmp/.mypy/python-3.8
- frozenlist/
pass_filenames: false

- repo: https://github.com/rhysd/actionlint
rev: v1.6.26
hooks:
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ endif

lint: .install-deps
ifndef CI
python -m pre_commit run --all-files
python -Im pre_commit run --all-files
else
python -Im pre_commit run mypy --all-files
endif
python -m mypy frozenlist --show-error-codes

.develop: .install-deps $(shell find frozenlist -type f) lint
pip install -e .
Expand Down
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[mypy]
follow_imports = silent
show_error_codes = true
strict_optional = True
warn_redundant_casts = True

Expand Down
1 change: 0 additions & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
build==1.0.3
coverage==7.3.2
cython==3.0.6
mypy==1.7.1; implementation_name=="cpython"
pre-commit==3.5.0
pytest==7.4.3
pytest-cov==4.1.0
Expand Down

0 comments on commit cd4c589

Please sign in to comment.